mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-20 00:07:06 -05:00
Transport buffer even when there is an error
This commit is contained in:
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…
Reference in New Issue
Block a user