Skip to content

Commit

Permalink
eth/downloader: fix timeout resurrection panic (ethereum#26652)
Browse files Browse the repository at this point in the history
* common/prque, eth/downloader: fix timeout resurrection panic

* common/prque: revert -1 hack for les, temporaryly!
  • Loading branch information
karalabe authored and shekhirin committed Jun 6, 2023
1 parent 43f205b commit 7ea3760
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions eth/downloader/fetchers_concurrent.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,13 +280,14 @@ func (d *Downloader) concurrentFetch(queue typedQueue, beaconMode bool) error {
// overloading it further.
delete(pending, req.Peer)
stales[req.Peer] = req
delete(ordering, req)

timeouts.Pop()
timeouts.Pop() // Popping an item will reorder indices in `ordering`, delete after, otherwise will resurrect!
if timeouts.Size() > 0 {
_, exp := timeouts.Peek()
timeout.Reset(time.Until(time.Unix(0, -exp)))
}
delete(ordering, req)

// New timeout potentially set if there are more requests pending,
// reschedule the failed one to a free peer
fails := queue.unreserve(req.Peer)
Expand Down

0 comments on commit 7ea3760

Please sign in to comment.