From c1440bd97c862743a741237cc5ac89ea5e8c432b Mon Sep 17 00:00:00 2001 From: Sir Darkrengarius Date: Sun, 16 Jun 2019 19:03:44 +0300 Subject: [PATCH] Fix inifinte loop in `dmsg.Transport`'s `Read` after passing the nil slice --- pkg/dmsg/transport.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/dmsg/transport.go b/pkg/dmsg/transport.go index e433f40283..93097b80d8 100644 --- a/pkg/dmsg/transport.go +++ b/pkg/dmsg/transport.go @@ -282,6 +282,9 @@ func (tp *Transport) Read(p []byte) (n int, err error) { startRead: tp.bufMx.Lock() n, err = tp.buf.Read(p) + if err != nil { + return n, err + } if tp.bufSize -= n; tp.bufSize < tpBufCap { acks := tp.ackBuf tp.ackBuf = make([]byte, 0, tpAckCap)