From: Joe Tsai Date: Sun, 4 Sep 2016 01:29:43 +0000 (-0700) Subject: compress/flate: clarify the behavior of Writer.Flush X-Git-Tag: go1.8beta1~1502 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=960016eca27f2e727886c51ed98dd5ae47c150dc;p=gostls13.git compress/flate: clarify the behavior of Writer.Flush Fixes #16068 Change-Id: I04e80a181c0b7356996f7a1158ea4895ff9e1e39 Reviewed-on: https://go-review.googlesource.com/28477 Run-TryBot: Joe Tsai TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- diff --git a/src/compress/flate/deflate.go b/src/compress/flate/deflate.go index 9f53d51a6e..ccf6d527d8 100644 --- a/src/compress/flate/deflate.go +++ b/src/compress/flate/deflate.go @@ -702,10 +702,12 @@ func (w *Writer) Write(data []byte) (n int, err error) { return w.d.write(data) } -// Flush flushes any pending compressed data to the underlying writer. +// Flush flushes any pending data to the underlying writer. // It is useful mainly in compressed network protocols, to ensure that // a remote reader has enough data to reconstruct a packet. // Flush does not return until the data has been written. +// Calling Flush when there is no pending data still causes the Writer +// to emit a sync marker of at least 4 bytes. // If the underlying writer returns an error, Flush returns that error. // // In the terminology of the zlib library, Flush is equivalent to Z_SYNC_FLUSH.