diff options
author | Péter Szilágyi <peterke@gmail.com> | 2016-07-22 22:55:46 +0800 |
---|---|---|
committer | Jeffrey Wilcke <geffobscura@gmail.com> | 2016-08-18 21:01:15 +0800 |
commit | 9eb2873a9cfef0013efeb002b95999e2a007067a (patch) | |
tree | 4294c451125cc52632f30e9e5df438be446e3c1b | |
parent | 08a7cd74da3f353b80ced16d1e2cf2d758606699 (diff) | |
download | go-tangerine-9eb2873a9cfef0013efeb002b95999e2a007067a.tar go-tangerine-9eb2873a9cfef0013efeb002b95999e2a007067a.tar.gz go-tangerine-9eb2873a9cfef0013efeb002b95999e2a007067a.tar.bz2 go-tangerine-9eb2873a9cfef0013efeb002b95999e2a007067a.tar.lz go-tangerine-9eb2873a9cfef0013efeb002b95999e2a007067a.tar.xz go-tangerine-9eb2873a9cfef0013efeb002b95999e2a007067a.tar.zst go-tangerine-9eb2873a9cfef0013efeb002b95999e2a007067a.zip |
[release/1.4.11] eth/downloader: fix the stall checks/drops during sync
(cherry picked from commit c7c82f1b44e07ad0906dde563cce46ea87b6fc83)
-rw-r--r-- | eth/downloader/downloader.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/eth/downloader/downloader.go b/eth/downloader/downloader.go index 01c0818a0..a10253b8e 100644 --- a/eth/downloader/downloader.go +++ b/eth/downloader/downloader.go @@ -1555,7 +1555,14 @@ func (d *Downloader) fetchParts(errCancel error, deliveryCh chan dataPack, deliv // Check for fetch request timeouts and demote the responsible peers for pid, fails := range expire() { if peer := d.peers.Peer(pid); peer != nil { - if fails > 1 { + // If a lot of retrieval elements expired, we might have overestimated the remote peer or perhaps + // ourselves. Only reset to minimal throughput but don't drop just yet. If even the minimal times + // out that sync wise we need to get rid of the peer. + // + // The reason the minimum threshold is 2 is because the downloader tries to estimate the bandwidth + // and latency of a peer separately, which requires pushing the measures capacity a bit and seeing + // how response times reacts, to it always requests one more than the minimum (i.e. min 2). + if fails > 2 { glog.V(logger.Detail).Infof("%s: %s delivery timeout", peer, strings.ToLower(kind)) setIdle(peer, 0) } else { |