mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-14 06:46:11 +00:00
merging reader
This commit is contained in:
4 files changed
+54
-7
No files matched your search
@@ -2,7 +2,6 @@ package ray
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"time"
|
||||
|
||||
@@ -13,8 +12,6 @@ const (
|
||||
bufferSize = 512
|
||||
)
|
||||
|
||||
var ErrReadTimeout = errors.New("Ray: timeout.")
|
||||
|
||||
// NewRay creates a new Ray for direct traffic transport.
|
||||
func NewRay(ctx context.Context) Ray {
|
||||
return &directRay{
|
||||
@@ -101,7 +98,7 @@ func (v *Stream) ReadTimeout(timeout time.Duration) (*buf.Buffer, error) {
|
||||
case <-v.err:
|
||||
return nil, io.ErrClosedPipe
|
||||
case <-time.After(timeout):
|
||||
return nil, ErrReadTimeout
|
||||
return nil, buf.ErrReadTimeout
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user