Skip to content

Commit beb0d16

Browse files
holimanucwong
authored andcommitted
eth/downloader: allow all timers to exit
1 parent 477724d commit beb0d16

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
@@ -199,12 +199,7 @@ func (d *Downloader) runStateSync(s *stateSync) *stateSync {
199199
}
200200
// Start a timer to notify the sync loop if the peer stalled.
201201
req.timer = time.AfterFunc(req.timeout, func() {
202-
select {
203-
case timeout <- req:
204-
case <-s.done:
205-
// Prevent leaking of timer goroutines in the unlikely case where a
206-
// timer is fired just before exiting runStateSync.
207-
}
202+
timeout <- req
208203
})
209204
active[req.peer.id] = req
210205
}
@@ -216,7 +211,6 @@ func (d *Downloader) runStateSync(s *stateSync) *stateSync {
216211
// are marked as idle and de facto _are_ idle.
217212
func (d *Downloader) spindownStateSync(active map[string]*stateReq, finished []*stateReq, timeout chan *stateReq, peerDrop chan *peerConnection) {
218213
log.Trace("State sync spinning down", "active", len(active), "finished", len(finished))
219-
220214
for len(active) > 0 {
221215
var (
222216
req *stateReq

0 commit comments

Comments
 (0)