mirror of https://github.com/v2ray/v2ray-core
Darien Raymond
6 years ago
3 changed files with 37 additions and 12 deletions
@ -0,0 +1,23 @@
|
||||
// +build 386 amd64 s390 s390x
|
||||
|
||||
package buf |
||||
|
||||
import ( |
||||
"io" |
||||
"syscall" |
||||
) |
||||
|
||||
func newReaderPlatform(reader io.Reader) Reader { |
||||
if useReadv { |
||||
if sc, ok := reader.(syscall.Conn); ok { |
||||
rawConn, err := sc.SyscallConn() |
||||
if err != nil { |
||||
newError("failed to get sysconn").Base(err).WriteToLog() |
||||
} else { |
||||
return NewReadVReader(reader, rawConn) |
||||
} |
||||
} |
||||
} |
||||
|
||||
return NewBytesToBufferReader(reader) |
||||
} |
Loading…
Reference in new issue