diff --git a/net/transport.go b/net/transport.go index 5ed92696..caf93678 100644 --- a/net/transport.go +++ b/net/transport.go @@ -14,10 +14,12 @@ func ReaderToChan(stream chan<- []byte, reader io.Reader) error { for { buffer := make([]byte, bufferSize) nBytes, err := reader.Read(buffer) + if nBytes > 0 { + stream <- buffer[:nBytes] + } if err != nil { return err } - stream <- buffer[:nBytes] } return nil }