Skip to content

Commit

Permalink
fix win test error; dont use ReadV on file
Browse files Browse the repository at this point in the history
  • Loading branch information
vcptr committed Nov 27, 2019
1 parent c060f9f commit 47660bf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 54 deletions.
12 changes: 4 additions & 8 deletions common/buf/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package buf
import (
"io"
"net"
"os"
"syscall"
"time"
)
Expand Down Expand Up @@ -57,19 +58,14 @@ func NewReader(reader io.Reader) Reader {
}
}

if useReadv {
_, isFile := reader.(*os.File)
if !isFile && useReadv {
if sc, ok := reader.(syscall.Conn); ok {
rawConn, err := sc.SyscallConn()
if err != nil {
newError("failed to get sysconn").Base(err).WriteToLog()
} else {
/*
Check if ReadVReader Can be used on this reader first
Fix https://github.com/v2ray/v2ray-core/issues/1666
*/
if ok, _ := checkReadVConstraint(rawConn); ok {
return NewReadVReader(reader, rawConn)
}
return NewReadVReader(reader, rawConn)
}
}
}
Expand Down
9 changes: 0 additions & 9 deletions common/buf/readv_constraint_other.go

This file was deleted.

37 changes: 0 additions & 37 deletions common/buf/readv_constraint_windows.go

This file was deleted.

0 comments on commit 47660bf

Please sign in to comment.