From ab25b636f5dfefabf478e692131c490243541870 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Wed, 27 Sep 2017 20:18:20 -0700 Subject: [PATCH] peer: add conditional sends on quit within readHandler message dispatch --- peer.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/peer.go b/peer.go index f323ce96..3fdc08d8 100644 --- a/peer.go +++ b/peer.go @@ -641,9 +641,17 @@ out: p.server.fundingMgr.processFundingLocked(msg, p.addr) case *lnwire.Shutdown: - p.shutdownChanReqs <- msg + select { + case p.shutdownChanReqs <- msg: + case <-p.quit: + break out + } case *lnwire.ClosingSigned: - p.closingSignedChanReqs <- msg + select { + case p.closingSignedChanReqs <- msg: + case <-p.quit: + break out + } case *lnwire.Error: p.server.fundingMgr.processFundingError(msg, p.addr)