Transport buffer even when there is an error

pull/11/head
V2Ray 9 years ago
parent 919fd5b16b
commit 194abb9d6c

@ -14,10 +14,12 @@ func ReaderToChan(stream chan<- []byte, reader io.Reader) error {
for { for {
buffer := make([]byte, bufferSize) buffer := make([]byte, bufferSize)
nBytes, err := reader.Read(buffer) nBytes, err := reader.Read(buffer)
if nBytes > 0 {
stream <- buffer[:nBytes]
}
if err != nil { if err != nil {
return err return err
} }
stream <- buffer[:nBytes]
} }
return nil return nil
} }

Loading…
Cancel
Save