You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
v2ray-core/common/io/transport.go

27 lines
400 B

package io
9 years ago
import (
"github.com/v2ray/v2ray-core/common/log"
)
func Pipe(reader Reader, writer Writer) error {
for {
buffer, err := reader.Read()
if err != nil {
9 years ago
log.Debug("IO: Pipe exits as ", err)
return err
}
if buffer.IsEmpty() {
buffer.Release()
continue
}
err = writer.Write(buffer)
if err != nil {
9 years ago
log.Debug("IO: Pipe exits as ", err)
return err
}
}
}