peer: allow msgConsumers to also exit on peer quit send
This commit is contained in:
parent
33c5c9661e
commit
5130949604
4
peer.go
4
peer.go
@ -753,6 +753,8 @@ func (ms *msgStream) msgConsumer() {
|
|||||||
// Otherwise, we'll check the message queue for any new
|
// Otherwise, we'll check the message queue for any new
|
||||||
// items.
|
// items.
|
||||||
select {
|
select {
|
||||||
|
case <-ms.peer.quit:
|
||||||
|
return
|
||||||
case <-ms.quit:
|
case <-ms.quit:
|
||||||
ms.msgCond.L.Unlock()
|
ms.msgCond.L.Unlock()
|
||||||
return
|
return
|
||||||
@ -777,6 +779,8 @@ func (ms *msgStream) msgConsumer() {
|
|||||||
// grow indefinitely.
|
// grow indefinitely.
|
||||||
select {
|
select {
|
||||||
case ms.producerSema <- struct{}{}:
|
case ms.producerSema <- struct{}{}:
|
||||||
|
case <-ms.peer.quit:
|
||||||
|
return
|
||||||
case <-ms.quit:
|
case <-ms.quit:
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user