mirror of https://github.com/v2ray/v2ray-core
use SingleReader on low end devices
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.
|
||||
|
|
|
@ -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)
|
||||
}
|
|
@ -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