mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-25 06:36:05 +03:00
Fix statistics error when not readV (#730)
This commit is contained in:
parent
7033f7cf5f
commit
b0886027f5
@ -71,17 +71,17 @@ func NewReader(reader io.Reader) Reader {
|
|||||||
|
|
||||||
_, isFile := reader.(*os.File)
|
_, isFile := reader.(*os.File)
|
||||||
if !isFile && useReadv {
|
if !isFile && useReadv {
|
||||||
var counter stats.Counter
|
|
||||||
|
|
||||||
if statConn, ok := reader.(*stat.CounterConnection); ok {
|
|
||||||
reader = statConn.Connection
|
|
||||||
counter = statConn.ReadCounter
|
|
||||||
}
|
|
||||||
if sc, ok := reader.(syscall.Conn); ok {
|
if sc, ok := reader.(syscall.Conn); ok {
|
||||||
rawConn, err := sc.SyscallConn()
|
rawConn, err := sc.SyscallConn()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
newError("failed to get sysconn").Base(err).WriteToLog()
|
newError("failed to get sysconn").Base(err).WriteToLog()
|
||||||
} else {
|
} else {
|
||||||
|
var counter stats.Counter
|
||||||
|
|
||||||
|
if statConn, ok := reader.(*stat.CounterConnection); ok {
|
||||||
|
reader = statConn.Connection
|
||||||
|
counter = statConn.ReadCounter
|
||||||
|
}
|
||||||
return NewReadVReader(reader, rawConn, counter)
|
return NewReadVReader(reader, rawConn, counter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user