diff --git a/peer.go b/peer.go index 7c979f85..63566a8e 100644 --- a/peer.go +++ b/peer.go @@ -1057,6 +1057,7 @@ out: chanStream = newChanMsgStream(p, targetChan) chanMsgStreams[targetChan] = chanStream chanStream.Start() + defer chanStream.Stop() } // With the stream obtained, add the message to the @@ -1069,12 +1070,6 @@ out: p.Disconnect(errors.New("read handler closed")) - for cid, chanStream := range chanMsgStreams { - chanStream.Stop() - - delete(chanMsgStreams, cid) - } - peerLog.Tracef("readHandler for peer %v done", p) }