diff options
author | rjl493456442 <garyrong0905@gmail.com> | 2017-08-14 13:48:24 +0800 |
---|---|---|
committer | rjl493456442 <garyrong0905@gmail.com> | 2017-08-14 13:51:37 +0800 |
commit | 02aa86e6591d4a70f152d8dc579df25e9aa0cd12 (patch) | |
tree | a4f099a0645ed3d93540e414b35a3596d930334c /eth | |
parent | 6ca59d98f88d4b4cc8bdeb2f023ff8c1fa228c6f (diff) | |
download | dexon-02aa86e6591d4a70f152d8dc579df25e9aa0cd12.tar.gz dexon-02aa86e6591d4a70f152d8dc579df25e9aa0cd12.tar.zst dexon-02aa86e6591d4a70f152d8dc579df25e9aa0cd12.zip |
eth/downloader: exit loop when there is no more available task
Diffstat (limited to 'eth')
-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 6ac58140a..13f3b11c9 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. |