aboutsummaryrefslogtreecommitdiffstats
path: root/eth
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-09-11 19:02:02 +0800
committerGitHub <noreply@github.com>2017-09-11 19:02:02 +0800
commitc8e70186a64b50d2ff23a9c79a08f731d3f72205 (patch)
treeaf06a301bf693ea51db9fc7fd55a403d3a318913 /eth
parent794741b8b2892adfd763c8895faeb63293b91c3a (diff)
parent02aa86e6591d4a70f152d8dc579df25e9aa0cd12 (diff)
downloadgo-tangerine-c8e70186a64b50d2ff23a9c79a08f731d3f72205.tar
go-tangerine-c8e70186a64b50d2ff23a9c79a08f731d3f72205.tar.gz
go-tangerine-c8e70186a64b50d2ff23a9c79a08f731d3f72205.tar.bz2
go-tangerine-c8e70186a64b50d2ff23a9c79a08f731d3f72205.tar.lz
go-tangerine-c8e70186a64b50d2ff23a9c79a08f731d3f72205.tar.xz
go-tangerine-c8e70186a64b50d2ff23a9c79a08f731d3f72205.tar.zst
go-tangerine-c8e70186a64b50d2ff23a9c79a08f731d3f72205.zip
Merge pull request #14973 from rjl493456442/fix_downloader
eth/downloader: exit loop when there is no more available task
Diffstat (limited to 'eth')
-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 38b66d9dd..5782d4cf5 100644
--- a/eth/downloader/downloader.go
+++ b/eth/downloader/downloader.go
@@ -1093,6 +1093,10 @@ func (d *Downloader) fetchParts(errCancel error, deliveryCh chan dataPack, deliv
throttled = true
break
}
+ // Short circuit if there is no more available task.
+ if pending() == 0 {
+ break
+ }
// Reserve a chunk of fetches for a peer. A nil can mean either that
// no more headers are available, or that the peer is known not to
// have them.