mirror of https://github.com/v2ray/v2ray-core
don't build readv for windows
parent
4b63638dca
commit
232e715b8b
|
@ -2,11 +2,8 @@ package buf
|
|||
|
||||
import (
|
||||
"io"
|
||||
"runtime"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"v2ray.com/core/common/platform"
|
||||
)
|
||||
|
||||
// Reader extends io.Reader with MultiBuffer.
|
||||
|
@ -50,16 +47,6 @@ func ReadAtLeastFrom(reader io.Reader, size int) Supplier {
|
|||
}
|
||||
}
|
||||
|
||||
var useReadv = false
|
||||
|
||||
func init() {
|
||||
const defaultFlagValue = "NOT_DEFINED_AT_ALL"
|
||||
value := platform.NewEnvFlag("v2ray.buf.readv").GetValue(func() string { return defaultFlagValue })
|
||||
if value != defaultFlagValue && (runtime.GOOS == "linux" || runtime.GOOS == "darwin") {
|
||||
useReadv = true
|
||||
}
|
||||
}
|
||||
|
||||
// NewReader creates a new Reader.
|
||||
// The Reader instance doesn't take the ownership of reader.
|
||||
func NewReader(reader io.Reader) Reader {
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
// +build !windows
|
||||
package buf
|
||||
|
||||
import (
|
||||
"io"
|
||||
"runtime"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
"v2ray.com/core/common/platform"
|
||||
)
|
||||
|
||||
type ReadVReader struct {
|
||||
|
@ -96,3 +100,13 @@ func (r *ReadVReader) ReadMultiBuffer() (MultiBuffer, error) {
|
|||
|
||||
return MultiBuffer(bs[:nBuf]), nil
|
||||
}
|
||||
|
||||
var useReadv = false
|
||||
|
||||
func init() {
|
||||
const defaultFlagValue = "NOT_DEFINED_AT_ALL"
|
||||
value := platform.NewEnvFlag("v2ray.buf.readv").GetValue(func() string { return defaultFlagValue })
|
||||
if value != defaultFlagValue && (runtime.GOOS == "linux" || runtime.GOOS == "darwin") {
|
||||
useReadv = true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
// +build windows
|
||||
package buf
|
||||
|
||||
import (
|
||||
"io"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
var useReadv = false
|
||||
|
||||
func NewReadVReader(reader io.Reader, rawConn syscall.RawConn) *ReadVReader {
|
||||
return nil
|
||||
}
|
Loading…
Reference in New Issue