mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-22 01:57:12 -05:00
clear logic in v2io.Pipe
This commit is contained in:
parent
e9ae553f78
commit
7fd94e1116
@ -3,12 +3,16 @@ package io
|
||||
func Pipe(reader Reader, writer Writer) error {
|
||||
for {
|
||||
buffer, err := reader.Read()
|
||||
if buffer.Len() > 0 {
|
||||
err = writer.Write(buffer)
|
||||
} else {
|
||||
buffer.Release()
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
if buffer.IsEmpty() {
|
||||
buffer.Release()
|
||||
continue
|
||||
}
|
||||
|
||||
err = writer.Write(buffer)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user