mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-22 01:57:12 -05:00
release buffer on error
This commit is contained in:
parent
7e77c1166d
commit
38dd84ba03
@ -6,6 +6,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"v2ray.com/core/common"
|
||||
"v2ray.com/core/common/buf"
|
||||
"v2ray.com/core/common/signal"
|
||||
"v2ray.com/core/common/signal/done"
|
||||
@ -106,6 +107,7 @@ func (p *pipe) writeMultiBufferInternal(mb buf.MultiBuffer) error {
|
||||
defer p.Unlock()
|
||||
|
||||
if err := p.getState(false); err != nil {
|
||||
mb.Release()
|
||||
return err
|
||||
}
|
||||
|
||||
@ -142,7 +144,7 @@ func (p *pipe) Close() error {
|
||||
}
|
||||
|
||||
p.state = closed
|
||||
p.done.Close()
|
||||
common.Must(p.done.Close())
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -161,5 +163,5 @@ func (p *pipe) CloseError() {
|
||||
p.data = nil
|
||||
}
|
||||
|
||||
p.done.Close()
|
||||
common.Must(p.done.Close())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user