1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 01:57:12 -05:00

allow 0 timeout

This commit is contained in:
Darien Raymond 2017-03-27 08:56:16 +02:00
parent eab2f1effc
commit bb4daedd4c
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -91,6 +91,10 @@ func (v *Stream) ReadTimeout(timeout time.Duration) (*buf.Buffer, error) {
case b := <-v.buffer:
return b, nil
default:
if timeout == 0 {
return nil, ErrReadTimeout
}
select {
case <-v.ctx.Done():
return nil, io.ErrClosedPipe