Unverified Commit 3086c256 authored by Péter Szilágyi's avatar Péter Szilágyi Committed by GitHub

eth/downloader: fix timeout resurrection panic (#26652)

* common/prque, eth/downloader: fix timeout resurrection panic

* common/prque: revert -1 hack for les, temporaryly!
parent da3c974c
...@@ -280,13 +280,14 @@ func (d *Downloader) concurrentFetch(queue typedQueue, beaconMode bool) error { ...@@ -280,13 +280,14 @@ func (d *Downloader) concurrentFetch(queue typedQueue, beaconMode bool) error {
// overloading it further. // overloading it further.
delete(pending, req.Peer) delete(pending, req.Peer)
stales[req.Peer] = req 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 { if timeouts.Size() > 0 {
_, exp := timeouts.Peek() _, exp := timeouts.Peek()
timeout.Reset(time.Until(time.Unix(0, -exp))) timeout.Reset(time.Until(time.Unix(0, -exp)))
} }
delete(ordering, req)
// New timeout potentially set if there are more requests pending, // New timeout potentially set if there are more requests pending,
// reschedule the failed one to a free peer // reschedule the failed one to a free peer
fails := queue.unreserve(req.Peer) fails := queue.unreserve(req.Peer)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment