From 33c5c9661e3ec8e8070d897e616af7b46160b69f Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Fri, 24 Aug 2018 17:57:06 -0700 Subject: [PATCH] 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. --- peer.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/peer.go b/peer.go index a9833e4b9..751f14648 100644 --- a/peer.go +++ b/peer.go @@ -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