1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-07-01 19:45:24 +00:00

fix lint warnings

This commit is contained in:
Darien Raymond 2017-10-22 15:03:20 +02:00
parent 49914adf00
commit 233bb08e56
3 changed files with 4 additions and 1 deletions

View File

@ -15,6 +15,7 @@ func NewBufferedWriter(writer io.Writer) *BufferedWriter {
return NewBufferedWriterSize(writer, 1024) return NewBufferedWriterSize(writer, 1024)
} }
// NewBufferedWriterSize creates a BufferedWriter with specified buffer size.
func NewBufferedWriterSize(writer io.Writer, size uint32) *BufferedWriter { func NewBufferedWriterSize(writer io.Writer, size uint32) *BufferedWriter {
return &BufferedWriter{ return &BufferedWriter{
writer: writer, writer: writer,

View File

@ -4,6 +4,7 @@ import (
"crypto/rand" "crypto/rand"
"testing" "testing"
"v2ray.com/core/common"
. "v2ray.com/core/common/buf" . "v2ray.com/core/common/buf"
"v2ray.com/core/testing/assert" "v2ray.com/core/testing/assert"
) )
@ -37,7 +38,7 @@ func TestBufferedWriterLargePayload(t *testing.T) {
assert.Bool(writer.IsBuffered()).IsTrue() assert.Bool(writer.IsBuffered()).IsTrue()
payload := make([]byte, 64*1024) payload := make([]byte, 64*1024)
rand.Read(payload) common.Must2(rand.Read(payload))
nBytes, err := writer.Write(payload[:512]) nBytes, err := writer.Write(payload[:512])
assert.Int(nBytes).Equals(512) assert.Int(nBytes).Equals(512)

View File

@ -11,6 +11,7 @@ type Reader interface {
Read() (MultiBuffer, error) Read() (MultiBuffer, error)
} }
// ErrReadTimeout is an error that happens with IO timeout.
var ErrReadTimeout = newError("IO timeout") var ErrReadTimeout = newError("IO timeout")
type TimeoutReader interface { type TimeoutReader interface {