Skip to content

Commit

Permalink
Fix inifinte loop in dmsg.Transport's Read after passing the nil …
Browse files Browse the repository at this point in the history
…slice
  • Loading branch information
Darkren committed Jun 16, 2019
1 parent 1767f09 commit c1440bd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/dmsg/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c1440bd

Please sign in to comment.