mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-02 23:47:07 -05:00
don't build readv for windows
This commit is contained in:
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
|
||||
}
|
||||
}
|
||||
|
13
common/buf/readv_reader_windows.go
Normal file
13
common/buf/readv_reader_windows.go
Normal file
@ -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
Block a user