From ef309f43d2b5bc981b6c6bc3c07021c04dbefdf0 Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Thu, 1 Nov 2018 17:35:55 -0700 Subject: [PATCH] discovery: pass peer quit signal to ProcessQueryMsg This commit passes the peer's quit signal to the gossipSyncer when attempt to hand off gossip query messages. This allows a rate-limited peer's read handler to break out immediately, which would otherwise remain stuck until the rate-limited gossip syncer pulled the message. --- discovery/gossiper.go | 2 +- discovery/syncer.go | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/discovery/gossiper.go b/discovery/gossiper.go index 8257c2fc5..66aba91b7 100644 --- a/discovery/gossiper.go +++ b/discovery/gossiper.go @@ -478,7 +478,7 @@ func (d *AuthenticatedGossiper) ProcessRemoteAnnouncement(msg lnwire.Message, // If we've found the message target, then we'll dispatch the // message directly to it. - syncer.ProcessQueryMsg(m) + syncer.ProcessQueryMsg(m, peer.QuitSignal()) errChan <- nil return errChan diff --git a/discovery/syncer.go b/discovery/syncer.go index 5568b3707..91793b72d 100644 --- a/discovery/syncer.go +++ b/discovery/syncer.go @@ -982,12 +982,11 @@ func (g *gossipSyncer) FilterGossipMsgs(msgs ...msgWithSenders) { // ProcessQueryMsg is used by outside callers to pass new channel time series // queries to the internal processing goroutine. -func (g *gossipSyncer) ProcessQueryMsg(msg lnwire.Message) { +func (g *gossipSyncer) ProcessQueryMsg(msg lnwire.Message, peerQuit <-chan struct{}) { select { case g.gossipMsgs <- msg: - return + case <-peerQuit: case <-g.quit: - return } }