From 17cdeac57fb3fc1d95885a0ba0a8a4e4578c7c4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E3=81=AE=E3=81=8B=E3=81=88=E3=81=A7?= Date: Sat, 7 Aug 2021 18:26:28 +0800 Subject: [PATCH] Fix: cannot disable ReadV --- common/buf/readv_reader.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/common/buf/readv_reader.go b/common/buf/readv_reader.go index 0cbac072..0813f230 100644 --- a/common/buf/readv_reader.go +++ b/common/buf/readv_reader.go @@ -4,7 +4,6 @@ package buf import ( "io" - "runtime" "syscall" "github.com/xtls/xray-core/common/platform" @@ -134,17 +133,13 @@ func (r *ReadVReader) ReadMultiBuffer() (MultiBuffer, error) { return mb, nil } -var useReadv = true +var useReadv bool func init() { const defaultFlagValue = "NOT_DEFINED_AT_ALL" value := platform.NewEnvFlag("xray.buf.readv").GetValue(func() string { return defaultFlagValue }) switch value { - case defaultFlagValue, "auto": - if (runtime.GOARCH == "386" || runtime.GOARCH == "amd64" || runtime.GOARCH == "s390x") && (runtime.GOOS == "linux" || runtime.GOOS == "darwin" || runtime.GOOS == "windows") { - useReadv = true - } - case "enable": + case defaultFlagValue, "auto", "enable": useReadv = true } }