mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-22 01:57:12 -05:00
use SingleReader on low end devices
This commit is contained in:
parent
f056ad1633
commit
5f8b64c646
@ -59,18 +59,7 @@ func NewReader(reader io.Reader) Reader {
|
||||
return mr
|
||||
}
|
||||
|
||||
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)
|
||||
return newReaderPlatform(reader)
|
||||
}
|
||||
|
||||
// NewWriter creates a new Writer.
|
||||
|
23
common/buf/io_highend.go
Normal file
23
common/buf/io_highend.go
Normal file
@ -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)
|
||||
}
|
13
common/buf/io_lowend.go
Normal file
13
common/buf/io_lowend.go
Normal file
@ -0,0 +1,13 @@
|
||||
// +build mips mipsle mips64 mips64le arm arm64
|
||||
|
||||
package buf
|
||||
|
||||
import (
|
||||
"io"
|
||||
)
|
||||
|
||||
func newReaderPlatform(reader io.Reader) Reader {
|
||||
return &SingleReader{
|
||||
Reader: reader,
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user