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

fix buffer release time

This commit is contained in:
Darien Raymond 2018-08-31 12:35:08 +02:00
parent 0067d3c80f
commit 334b7bf5ed
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -107,7 +107,6 @@ func (p *pipe) writeMultiBufferInternal(mb buf.MultiBuffer) error {
defer p.Unlock()
if err := p.getState(false); err != nil {
mb.Release()
return err
}
@ -122,7 +121,11 @@ func (p *pipe) WriteMultiBuffer(mb buf.MultiBuffer) error {
for {
err := p.writeMultiBufferInternal(mb)
if err == nil || err != errBufferFull {
if err == nil {
p.readSignal.Signal()
return nil
} else if err != errBufferFull {
mb.Release()
p.readSignal.Signal()
return err
}