mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 12:46:44 +00:00
p2p/tracker: fix head detection in Fulfil to avoid unnecessary timer reschedules
This commit is contained in:
parent
e63e37be5e
commit
9f62d3b188
1 changed files with 2 additions and 1 deletions
|
|
@ -185,9 +185,10 @@ func (t *Tracker) Fulfil(peer string, version uint, code uint64, id uint64) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Everything matches, mark the request serviced and meter it
|
// Everything matches, mark the request serviced and meter it
|
||||||
|
wasHead := t.expire.Front() == req.expire
|
||||||
t.expire.Remove(req.expire)
|
t.expire.Remove(req.expire)
|
||||||
delete(t.pending, id)
|
delete(t.pending, id)
|
||||||
if req.expire.Prev() == nil {
|
if wasHead {
|
||||||
if t.wake.Stop() {
|
if t.wake.Stop() {
|
||||||
t.schedule()
|
t.schedule()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue