mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-02 23:47:07 -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
|
||||
case closed:
|
||||
if forRead {
|
||||
if !forRead {
|
||||
return io.ErrClosedPipe
|
||||
}
|
||||
if !p.data.IsEmpty() {
|
||||
return nil
|
||||
}
|
||||
return io.EOF
|
||||
}
|
||||
return io.ErrClosedPipe
|
||||
case errord:
|
||||
return io.ErrClosedPipe
|
||||
default:
|
||||
@ -139,7 +139,9 @@ func (p *pipe) CloseError() {
|
||||
p.Lock()
|
||||
defer p.Unlock()
|
||||
|
||||
p.state = errord
|
||||
if p.state == closed || p.state == errord {
|
||||
return
|
||||
}
|
||||
|
||||
if !p.data.IsEmpty() {
|
||||
p.data.Release()
|
||||
|
Loading…
Reference in New Issue
Block a user