peer: stop chanMsg streams in defer right after creation
This commit is contained in:
parent
ce115a6a59
commit
a7656454aa
7
peer.go
7
peer.go
@ -1057,6 +1057,7 @@ out:
|
|||||||
chanStream = newChanMsgStream(p, targetChan)
|
chanStream = newChanMsgStream(p, targetChan)
|
||||||
chanMsgStreams[targetChan] = chanStream
|
chanMsgStreams[targetChan] = chanStream
|
||||||
chanStream.Start()
|
chanStream.Start()
|
||||||
|
defer chanStream.Stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
// With the stream obtained, add the message to the
|
// With the stream obtained, add the message to the
|
||||||
@ -1069,12 +1070,6 @@ out:
|
|||||||
|
|
||||||
p.Disconnect(errors.New("read handler closed"))
|
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)
|
peerLog.Tracef("readHandler for peer %v done", p)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user