1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 10:08:15 -05:00

clear logic in v2io.Pipe

This commit is contained in:
v2ray 2016-05-11 11:54:29 -07:00
parent e9ae553f78
commit 7fd94e1116

View File

@ -3,12 +3,16 @@ package io
func Pipe(reader Reader, writer Writer) error { func Pipe(reader Reader, writer Writer) error {
for { for {
buffer, err := reader.Read() buffer, err := reader.Read()
if buffer.Len() > 0 { if err != nil {
err = writer.Write(buffer) return nil
} else {
buffer.Release()
} }
if buffer.IsEmpty() {
buffer.Release()
continue
}
err = writer.Write(buffer)
if err != nil { if err != nil {
return nil return nil
} }