|
@@ -3,6 +3,7 @@ package buf
|
|
|
import (
|
|
import (
|
|
|
"io"
|
|
"io"
|
|
|
"net"
|
|
"net"
|
|
|
|
|
+ "os"
|
|
|
"syscall"
|
|
"syscall"
|
|
|
"time"
|
|
"time"
|
|
|
)
|
|
)
|
|
@@ -57,19 +58,14 @@ func NewReader(reader io.Reader) Reader {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if useReadv {
|
|
|
|
|
|
|
+ _, isFile := reader.(*os.File)
|
|
|
|
|
+ if !isFile && useReadv {
|
|
|
if sc, ok := reader.(syscall.Conn); ok {
|
|
if sc, ok := reader.(syscall.Conn); ok {
|
|
|
rawConn, err := sc.SyscallConn()
|
|
rawConn, err := sc.SyscallConn()
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
newError("failed to get sysconn").Base(err).WriteToLog()
|
|
newError("failed to get sysconn").Base(err).WriteToLog()
|
|
|
} else {
|
|
} else {
|
|
|
- /*
|
|
|
|
|
- Check if ReadVReader Can be used on this reader first
|
|
|
|
|
- Fix https://github.com/v2ray/v2ray-core/issues/1666
|
|
|
|
|
- */
|
|
|
|
|
- if ok, _ := checkReadVConstraint(rawConn); ok {
|
|
|
|
|
- return NewReadVReader(reader, rawConn)
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ return NewReadVReader(reader, rawConn)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|