mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-05 00:47:51 -05:00
don't error if pipe is already closed.
This commit is contained in:
parent
97341693f3
commit
a0dc8d19fa
@ -37,13 +37,13 @@ func (p *pipe) getState(forRead bool) error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
case closed:
|
case closed:
|
||||||
if forRead {
|
if !forRead {
|
||||||
|
return io.ErrClosedPipe
|
||||||
|
}
|
||||||
if !p.data.IsEmpty() {
|
if !p.data.IsEmpty() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return io.EOF
|
return io.EOF
|
||||||
}
|
|
||||||
return io.ErrClosedPipe
|
|
||||||
case errord:
|
case errord:
|
||||||
return io.ErrClosedPipe
|
return io.ErrClosedPipe
|
||||||
default:
|
default:
|
||||||
@ -139,7 +139,9 @@ func (p *pipe) CloseError() {
|
|||||||
p.Lock()
|
p.Lock()
|
||||||
defer p.Unlock()
|
defer p.Unlock()
|
||||||
|
|
||||||
p.state = errord
|
if p.state == closed || p.state == errord {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if !p.data.IsEmpty() {
|
if !p.data.IsEmpty() {
|
||||||
p.data.Release()
|
p.data.Release()
|
||||||
|
Loading…
Reference in New Issue
Block a user