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