diff --git a/discovery/sync_manager.go b/discovery/sync_manager.go index 99c320d79..807bd99b9 100644 --- a/discovery/sync_manager.go +++ b/discovery/sync_manager.go @@ -538,6 +538,9 @@ func (m *SyncManager) syncerHandler(ctx context.Context) { case <-m.quit: return + + case <-ctx.Done(): + return } } } diff --git a/discovery/syncer.go b/discovery/syncer.go index abbf61923..0b4e7030b 100644 --- a/discovery/syncer.go +++ b/discovery/syncer.go @@ -527,6 +527,9 @@ func (g *GossipSyncer) channelGraphSyncer(ctx context.Context) { case <-g.cg.Done(): return + + case <-ctx.Done(): + return } // We'll enter this state once we've discovered which channels @@ -577,6 +580,9 @@ func (g *GossipSyncer) channelGraphSyncer(ctx context.Context) { case <-g.cg.Done(): return + + case <-ctx.Done(): + return } // This is our final terminal state where we'll only reply to @@ -623,6 +629,9 @@ func (g *GossipSyncer) channelGraphSyncer(ctx context.Context) { case <-g.cg.Done(): return + + case <-ctx.Done(): + return } } } @@ -656,6 +665,9 @@ func (g *GossipSyncer) replyHandler(ctx context.Context) { case <-g.cg.Done(): return + + case <-ctx.Done(): + return } } } @@ -1298,6 +1310,8 @@ func (g *GossipSyncer) ApplyGossipFilter(ctx context.Context, case <-g.syncerSema: case <-g.cg.Done(): return ErrGossipSyncerExiting + case <-ctx.Done(): + return ctx.Err() } // We don't put this in a defer because if the goroutine is launched, @@ -1370,6 +1384,8 @@ func (g *GossipSyncer) FilterGossipMsgs(ctx context.Context, select { case <-g.cg.Done(): return + case <-ctx.Done(): + return default: }