Skip to content

Commit cbbc54c

Browse files
authored
Merge pull request #21433 from holiman/statsync_exiter
eth/downloader: allow all timers to exit
2 parents 48b484c + 7cee250 commit cbbc54c

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

eth/downloader/statesync.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,7 @@ func (d *Downloader) runStateSync(s *stateSync) *stateSync {
200200
}
201201
// Start a timer to notify the sync loop if the peer stalled.
202202
req.timer = time.AfterFunc(req.timeout, func() {
203-
select {
204-
case timeout <- req:
205-
case <-s.done:
206-
// Prevent leaking of timer goroutines in the unlikely case where a
207-
// timer is fired just before exiting runStateSync.
208-
}
203+
timeout <- req
209204
})
210205
active[req.peer.id] = req
211206
}
@@ -217,7 +212,6 @@ func (d *Downloader) runStateSync(s *stateSync) *stateSync {
217212
// are marked as idle and de facto _are_ idle.
218213
func (d *Downloader) spindownStateSync(active map[string]*stateReq, finished []*stateReq, timeout chan *stateReq, peerDrop chan *peerConnection) {
219214
log.Trace("State sync spinning down", "active", len(active), "finished", len(finished))
220-
221215
for len(active) > 0 {
222216
var (
223217
req *stateReq

0 commit comments

Comments
 (0)