From 5130949604b04eb164e09a6b77850a748fd40e7f Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Fri, 24 Aug 2018 17:58:24 -0700 Subject: [PATCH] peer: allow msgConsumers to also exit on peer quit send --- peer.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/peer.go b/peer.go index 751f1464..bbf3a60f 100644 --- a/peer.go +++ b/peer.go @@ -753,6 +753,8 @@ func (ms *msgStream) msgConsumer() { // Otherwise, we'll check the message queue for any new // items. select { + case <-ms.peer.quit: + return case <-ms.quit: ms.msgCond.L.Unlock() return @@ -777,6 +779,8 @@ func (ms *msgStream) msgConsumer() { // grow indefinitely. select { case ms.producerSema <- struct{}{}: + case <-ms.peer.quit: + return case <-ms.quit: return }