1
0
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:
Darien Raymond 2018-08-31 12:12:40 +02:00
parent 7e77c1166d
commit 38dd84ba03
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -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())
}