mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-22 10:08:15 -05:00
allow 0 timeout
This commit is contained in:
parent
eab2f1effc
commit
bb4daedd4c
@ -91,6 +91,10 @@ func (v *Stream) ReadTimeout(timeout time.Duration) (*buf.Buffer, error) {
|
|||||||
case b := <-v.buffer:
|
case b := <-v.buffer:
|
||||||
return b, nil
|
return b, nil
|
||||||
default:
|
default:
|
||||||
|
if timeout == 0 {
|
||||||
|
return nil, ErrReadTimeout
|
||||||
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-v.ctx.Done():
|
case <-v.ctx.Done():
|
||||||
return nil, io.ErrClosedPipe
|
return nil, io.ErrClosedPipe
|
||||||
|
Loading…
Reference in New Issue
Block a user