mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-05 00:47:51 -05:00
fix lint warnings
This commit is contained in:
parent
443fd7c9a5
commit
e8e7921613
@ -198,8 +198,6 @@ type Connection struct {
|
|||||||
|
|
||||||
dataUpdater *Updater
|
dataUpdater *Updater
|
||||||
pingUpdater *Updater
|
pingUpdater *Updater
|
||||||
|
|
||||||
mergingWriter buf.Writer
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewConnection create a new KCP connection between local and remote.
|
// NewConnection create a new KCP connection between local and remote.
|
||||||
@ -285,7 +283,7 @@ func (v *Connection) ReadMultiBuffer() (buf.MultiBuffer, error) {
|
|||||||
|
|
||||||
duration := time.Minute
|
duration := time.Minute
|
||||||
if !v.rd.IsZero() {
|
if !v.rd.IsZero() {
|
||||||
duration = v.rd.Sub(time.Now())
|
duration = time.Until(v.rd)
|
||||||
if duration < 0 {
|
if duration < 0 {
|
||||||
return nil, ErrIOTimeout
|
return nil, ErrIOTimeout
|
||||||
}
|
}
|
||||||
@ -322,7 +320,7 @@ func (v *Connection) Read(b []byte) (int, error) {
|
|||||||
|
|
||||||
duration := time.Minute
|
duration := time.Minute
|
||||||
if !v.rd.IsZero() {
|
if !v.rd.IsZero() {
|
||||||
duration = v.rd.Sub(time.Now())
|
duration = time.Until(v.rd)
|
||||||
if duration < 0 {
|
if duration < 0 {
|
||||||
return 0, ErrIOTimeout
|
return 0, ErrIOTimeout
|
||||||
}
|
}
|
||||||
@ -358,7 +356,7 @@ func (v *Connection) Write(b []byte) (int, error) {
|
|||||||
|
|
||||||
duration := time.Minute
|
duration := time.Minute
|
||||||
if !v.wd.IsZero() {
|
if !v.wd.IsZero() {
|
||||||
duration = v.wd.Sub(time.Now())
|
duration = time.Until(v.wd)
|
||||||
if duration < 0 {
|
if duration < 0 {
|
||||||
return totalWritten, ErrIOTimeout
|
return totalWritten, ErrIOTimeout
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package kcp
|
package kcp
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"v2ray.com/core/common"
|
||||||
"v2ray.com/core/common/buf"
|
"v2ray.com/core/common/buf"
|
||||||
"v2ray.com/core/common/serial"
|
"v2ray.com/core/common/serial"
|
||||||
)
|
)
|
||||||
@ -65,9 +66,9 @@ func (v *DataSegment) SetData(data []byte) {
|
|||||||
if v.Data == nil {
|
if v.Data == nil {
|
||||||
v.Data = buf.New()
|
v.Data = buf.New()
|
||||||
}
|
}
|
||||||
v.Data.Reset(func(b []byte) (int, error) {
|
common.Must(v.Data.Reset(func(b []byte) (int, error) {
|
||||||
return copy(b, data), nil
|
return copy(b, data), nil
|
||||||
})
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *DataSegment) Bytes() buf.Supplier {
|
func (v *DataSegment) Bytes() buf.Supplier {
|
||||||
|
Loading…
Reference in New Issue
Block a user