Skip to content

Commit

Permalink
eth/downloader: set deliverytime on drops and timeouts too
Browse files Browse the repository at this point in the history
  • Loading branch information
holiman committed Aug 7, 2020
1 parent 8f24097 commit 9fea1a5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions eth/downloader/statesync.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ func (d *Downloader) runStateSync(s *stateSync) *stateSync {
// Finalize the request and queue up for processing
req.timer.Stop()
req.dropped = true
req.delivered = time.Now()

finished = append(finished, req)
delete(active, p.id)
Expand All @@ -176,6 +177,7 @@ func (d *Downloader) runStateSync(s *stateSync) *stateSync {
if active[req.peer.id] != req {
continue
}
req.delivered = time.Now()
// Move the timed out data back into the download queue
finished = append(finished, req)
delete(active, req.peer.id)
Expand All @@ -193,6 +195,7 @@ func (d *Downloader) runStateSync(s *stateSync) *stateSync {
// Move the previous request to the finished set
old.timer.Stop()
old.dropped = true
old.delivered = time.Now()
finished = append(finished, old)
}
// Start a timer to notify the sync loop if the peer stalled.
Expand Down

0 comments on commit 9fea1a5

Please sign in to comment.