aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-05-02 21:14:35 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-05-02 21:14:35 +0800
commit96c2ab22e0980f1aa0767abe14f9306badd28538 (patch)
treef86f2002fc012046792f23e99d8f80f0de99072f
parent5884606ec3c603c29337e527d348138fa2b9a27a (diff)
downloadgo-tangerine-96c2ab22e0980f1aa0767abe14f9306badd28538.tar
go-tangerine-96c2ab22e0980f1aa0767abe14f9306badd28538.tar.gz
go-tangerine-96c2ab22e0980f1aa0767abe14f9306badd28538.tar.bz2
go-tangerine-96c2ab22e0980f1aa0767abe14f9306badd28538.tar.lz
go-tangerine-96c2ab22e0980f1aa0767abe14f9306badd28538.tar.xz
go-tangerine-96c2ab22e0980f1aa0767abe14f9306badd28538.tar.zst
go-tangerine-96c2ab22e0980f1aa0767abe14f9306badd28538.zip
eth/downloader: fix a potential issue against future refactors
-rw-r--r--eth/downloader/downloader.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/eth/downloader/downloader.go b/eth/downloader/downloader.go
index d26995782..839969f03 100644
--- a/eth/downloader/downloader.go
+++ b/eth/downloader/downloader.go
@@ -1491,6 +1491,10 @@ func (d *Downloader) qosTuner() {
func (d *Downloader) qosReduceConfidence() {
// If we have a single peer, confidence is always 1
peers := uint64(d.peers.Len())
+ if peers == 0 {
+ // Ensure peer connectivity races don't catch us off guard
+ return
+ }
if peers == 1 {
atomic.StoreUint64(&d.rttConfidence, 1000000)
return