1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-09-27 22:36:12 -04:00

fix lint warnings

This commit is contained in:
Darien Raymond 2017-12-03 16:40:10 +01:00
parent 443fd7c9a5
commit e8e7921613
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
2 changed files with 6 additions and 7 deletions

View File

@ -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
}

View File

@ -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 {