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.
This commit is contained in:
parent
19552b0dbf
commit
13a6d413ac
@ -481,6 +481,11 @@ func (d *AuthenticatedGossiper) ProcessRemoteAnnouncement(msg lnwire.Message,
|
|||||||
|
|
||||||
select {
|
select {
|
||||||
case d.networkMsgs <- nMsg:
|
case d.networkMsgs <- nMsg:
|
||||||
|
|
||||||
|
// If the peer that sent us this error is quitting, then we don't need
|
||||||
|
// to send back an error and can return immediately.
|
||||||
|
case <-peer.QuitSignal():
|
||||||
|
return nil
|
||||||
case <-d.quit:
|
case <-d.quit:
|
||||||
nMsg.err <- ErrGossiperShuttingDown
|
nMsg.err <- ErrGossiperShuttingDown
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user