From 334b7bf5ed27894deda61b4a070fb8db2df6c2e4 Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Fri, 31 Aug 2018 12:35:08 +0200 Subject: [PATCH] fix buffer release time --- transport/pipe/impl.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/transport/pipe/impl.go b/transport/pipe/impl.go index b795aa74..1d1035e6 100644 --- a/transport/pipe/impl.go +++ b/transport/pipe/impl.go @@ -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 }