From 7cee2509c07e5514dc7647fcf8a4f066feaaa6df Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Mon, 10 Aug 2020 10:42:33 +0200 Subject: [PATCH] eth/downloader: allow all timers to exit --- eth/downloader/statesync.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/eth/downloader/statesync.go b/eth/downloader/statesync.go index 60afcf431..5951dbac2 100644 --- a/eth/downloader/statesync.go +++ b/eth/downloader/statesync.go @@ -197,12 +197,7 @@ func (d *Downloader) runStateSync(s *stateSync) *stateSync { } // Start a timer to notify the sync loop if the peer stalled. req.timer = time.AfterFunc(req.timeout, func() { - select { - case timeout <- req: - case <-s.done: - // Prevent leaking of timer goroutines in the unlikely case where a - // timer is fired just before exiting runStateSync. - } + timeout <- req }) active[req.peer.id] = req } @@ -214,7 +209,6 @@ func (d *Downloader) runStateSync(s *stateSync) *stateSync { // are marked as idle and de facto _are_ idle. func (d *Downloader) spindownStateSync(active map[string]*stateReq, finished []*stateReq, timeout chan *stateReq, peerDrop chan *peerConnection) { log.Trace("State sync spinning down", "active", len(active), "finished", len(finished)) - for len(active) > 0 { var ( req *stateReq