diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-09-11 19:02:02 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-11 19:02:02 +0800 |
commit | c8e70186a64b50d2ff23a9c79a08f731d3f72205 (patch) | |
tree | af06a301bf693ea51db9fc7fd55a403d3a318913 | |
parent | 794741b8b2892adfd763c8895faeb63293b91c3a (diff) | |
parent | 02aa86e6591d4a70f152d8dc579df25e9aa0cd12 (diff) | |
download | dexon-c8e70186a64b50d2ff23a9c79a08f731d3f72205.tar.gz dexon-c8e70186a64b50d2ff23a9c79a08f731d3f72205.tar.zst dexon-c8e70186a64b50d2ff23a9c79a08f731d3f72205.zip |
Merge pull request #14973 from rjl493456442/fix_downloader
eth/downloader: exit loop when there is no more available task
-rw-r--r-- | eth/downloader/downloader.go | 4 |
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. |