aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWenbiao Zheng <delweng@gmail.com>2018-11-07 21:30:19 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-11-07 21:30:19 +0800
commitb35165555d737042d5f958413827c31a7a5f4805 (patch)
tree7245541a5fd79a6cbfff82c8979d3154215f541e
parent5b74bb6445a7fb7220da74c6c6e891c20e9a26dc (diff)
downloaddexon-b35165555d737042d5f958413827c31a7a5f4805.tar.gz
dexon-b35165555d737042d5f958413827c31a7a5f4805.tar.zst
dexon-b35165555d737042d5f958413827c31a7a5f4805.zip
eth/downloader: remove the expired id directly (#17963)
-rw-r--r--eth/downloader/queue.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/eth/downloader/queue.go b/eth/downloader/queue.go
index c6b635aff..863cc8de1 100644
--- a/eth/downloader/queue.go
+++ b/eth/downloader/queue.go
@@ -664,12 +664,11 @@ func (q *queue) expire(timeout time.Duration, pendPool map[string]*fetchRequest,
}
// Add the peer to the expiry report along the number of failed requests
expiries[id] = len(request.Headers)
+
+ // Remove the expired requests from the pending pool directly
+ delete(pendPool, id)
}
}
- // Remove the expired requests from the pending pool
- for id := range expiries {
- delete(pendPool, id)
- }
return expiries
}