Skip to content

Commit 13a6d41

Browse files
committed
discovery: select on peer's QuitSignal to allow caller to unblock if disconnecting
In this commit, we select on the peer's QuitSignal to allow the caller to unblock if the peer itself is disconnecting. With this change, we now ensure that it isn't possible for a peer to block on this method and prevent a graceful exit.
1 parent 19552b0 commit 13a6d41

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

discovery/gossiper.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,11 @@ func (d *AuthenticatedGossiper) ProcessRemoteAnnouncement(msg lnwire.Message,
481481

482482
select {
483483
case d.networkMsgs <- nMsg:
484+
485+
// If the peer that sent us this error is quitting, then we don't need
486+
// to send back an error and can return immediately.
487+
case <-peer.QuitSignal():
488+
return nil
484489
case <-d.quit:
485490
nMsg.err <- ErrGossiperShuttingDown
486491
}

0 commit comments

Comments
 (0)