peer: stop chanMsg streams in defer right after creation

This commit is contained in:
Olaoluwa Osuntokun 2018-08-24 17:53:07 -07:00
parent ce115a6a59
commit a7656454aa
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21

@ -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)
}