Skip to content

Commit

Permalink
Merge pull request #21433 from holiman/statsync_exiter
Browse files Browse the repository at this point in the history
eth/downloader: allow all timers to exit
  • Loading branch information
karalabe authored Aug 10, 2020
2 parents 48b484c + 7cee250 commit cbbc54c
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions eth/downloader/statesync.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,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
}
Expand All @@ -217,7 +212,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
Expand Down

0 comments on commit cbbc54c

Please sign in to comment.