Skip to content

Commit c7c82f1

Browse files
committed
eth/downloader: fix the stall checks/drops during sync
1 parent f58ac2b commit c7c82f1

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎eth/downloader/downloader.go‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1555,7 +1555,14 @@ func (d *Downloader) fetchParts(errCancel error, deliveryCh chan dataPack, deliv
15551555
// Check for fetch request timeouts and demote the responsible peers
15561556
for pid, fails := range expire() {
15571557
if peer := d.peers.Peer(pid); peer != nil {
1558-
if fails > 1 {
1558+
// If a lot of retrieval elements expired, we might have overestimated the remote peer or perhaps
1559+
// ourselves. Only reset to minimal throughput but don't drop just yet. If even the minimal times
1560+
// out that sync wise we need to get rid of the peer.
1561+
//
1562+
// The reason the minimum threshold is 2 is because the downloader tries to estimate the bandwidth
1563+
// and latency of a peer separately, which requires pushing the measures capacity a bit and seeing
1564+
// how response times reacts, to it always requests one more than the minimum (i.e. min 2).
1565+
if fails > 2 {
15591566
glog.V(logger.Detail).Infof("%s: %s delivery timeout", peer, strings.ToLower(kind))
15601567
setIdle(peer, 0)
15611568
} else {

0 commit comments

Comments
 (0)