1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-25 17:05:23 +00:00

Transport buffer even when there is an error

This commit is contained in:
V2Ray 2015-09-14 00:56:49 +02:00
parent 919fd5b16b
commit 194abb9d6c

View File

@ -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
}