aboutsummaryrefslogtreecommitdiffstats
path: root/eth
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-09-03 21:52:18 +0800
committerFelix Lange <fjl@twurst.com>2015-09-03 21:52:18 +0800
commite2d7c1a52303ebdd8c2956badad5e600bf93ff33 (patch)
tree160e7c4861ea071697eebf4b92a6c361f3ed17c7 /eth
parentebbe25ee71deb50e67bd457ac2598e71b51a3bba (diff)
parent1f1d73ab747da9edc1c8f6bd39835e5653c539ee (diff)
downloadgo-tangerine-e2d7c1a52303ebdd8c2956badad5e600bf93ff33.tar
go-tangerine-e2d7c1a52303ebdd8c2956badad5e600bf93ff33.tar.gz
go-tangerine-e2d7c1a52303ebdd8c2956badad5e600bf93ff33.tar.bz2
go-tangerine-e2d7c1a52303ebdd8c2956badad5e600bf93ff33.tar.lz
go-tangerine-e2d7c1a52303ebdd8c2956badad5e600bf93ff33.tar.xz
go-tangerine-e2d7c1a52303ebdd8c2956badad5e600bf93ff33.tar.zst
go-tangerine-e2d7c1a52303ebdd8c2956badad5e600bf93ff33.zip
Merge pull request #1752 from karalabe/fix-eth61-test
eth/downloader: fix race causing occasional test failure
Diffstat (limited to 'eth')
-rw-r--r--eth/downloader/downloader.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/eth/downloader/downloader.go b/eth/downloader/downloader.go
index 574f2ba15..73f95bf64 100644
--- a/eth/downloader/downloader.go
+++ b/eth/downloader/downloader.go
@@ -739,9 +739,11 @@ func (d *Downloader) fetchBlocks61(from uint64) error {
break
}
// Send a download request to all idle peers, until throttled
+ throttled := false
for _, peer := range d.peers.IdlePeers() {
// Short circuit if throttling activated
if d.queue.Throttle() {
+ throttled = true
break
}
// Reserve a chunk of hashes for a peer. A nil can mean either that
@@ -762,7 +764,7 @@ func (d *Downloader) fetchBlocks61(from uint64) error {
}
// Make sure that we have peers available for fetching. If all peers have been tried
// and all failed throw an error
- if !d.queue.Throttle() && d.queue.InFlight() == 0 {
+ if !throttled && d.queue.InFlight() == 0 {
return errPeersUnavailable
}
}