1
0
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:
Darien Raymond 2018-07-25 11:19:16 +02:00
parent 4b63638dca
commit 232e715b8b
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
3 changed files with 27 additions and 13 deletions

View File

@ -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 {

View File

@ -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
}
}

View 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
}