Skip 0 byte stream writes (#10875)

Don't send a packet when receiving 0 bytes or there is an error recorded
master
Klaus Post 4 years ago committed by GitHub
parent aa158228f9
commit 1c3590078d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      cmd/storage-rest-server.go

@ -781,6 +781,10 @@ type httpStreamResponse struct {
// Write part of the the streaming response.
// Note that upstream errors are currently not forwarded, but may be in the future.
func (h *httpStreamResponse) Write(b []byte) (int, error) {
if len(b) == 0 || h.err != nil {
// Ignore 0 length blocks
return 0, h.err
}
tmp := make([]byte, len(b))
copy(tmp, b)
h.block <- tmp

Loading…
Cancel
Save