peer: properly clean up chanMsgStreams map on readHandler exit

This commit ensures that all references within the chanMsgStreams are
all removed and deleted when the readHandler exits. This ensures that
all objects don’t have extra references, and will properly be garbage
collected.
This commit is contained in:
Olaoluwa Osuntokun 2017-08-03 13:52:02 -07:00
parent 36f4e2046d
commit c183e8984c
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2
1 changed files with 3 additions and 1 deletions

View File

@ -645,8 +645,10 @@ out:
p.Disconnect(errors.New("read handler closed"))
for _, chanStream := range chanMsgStreams {
for cid, chanStream := range chanMsgStreams {
chanStream.Stop()
delete(chanMsgStreams, cid)
}
p.wg.Done()