peer: allow msgStream goroutines to quit within the apply function

In this commit, we thread through the quit of the peer to the execution
of the apply function for a msgStream. This change ensures that if the
target is still processing the message, then the peer is able to exit
cleanly and not block insensately.
This commit is contained in:
Olaoluwa Osuntokun 2018-08-24 17:57:06 -07:00
parent 0b5a403fce
commit 33c5c9661e
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21

@ -836,7 +836,9 @@ func newChanMsgStream(p *peer, cid lnwire.ChannelID) *msgStream {
// to the other side, they immediately send a
// channel update message, but we haven't yet
// sent the channel to the channelManager.
p.server.fundingMgr.waitUntilChannelOpen(cid)
p.server.fundingMgr.waitUntilChannelOpen(
cid, p.quit,
)
}
// TODO(roasbeef): only wait if not chan sync