aboutsummaryrefslogtreecommitdiffstats
path: root/eth/downloader/downloader.go
diff options
context:
space:
mode:
authorrjl493456442 <garyrong0905@gmail.com>2017-08-14 13:48:24 +0800
committerrjl493456442 <garyrong0905@gmail.com>2017-08-14 13:51:37 +0800
commit02aa86e6591d4a70f152d8dc579df25e9aa0cd12 (patch)
treea4f099a0645ed3d93540e414b35a3596d930334c /eth/downloader/downloader.go
parent6ca59d98f88d4b4cc8bdeb2f023ff8c1fa228c6f (diff)
downloadgo-tangerine-02aa86e6591d4a70f152d8dc579df25e9aa0cd12.tar
go-tangerine-02aa86e6591d4a70f152d8dc579df25e9aa0cd12.tar.gz
go-tangerine-02aa86e6591d4a70f152d8dc579df25e9aa0cd12.tar.bz2
go-tangerine-02aa86e6591d4a70f152d8dc579df25e9aa0cd12.tar.lz
go-tangerine-02aa86e6591d4a70f152d8dc579df25e9aa0cd12.tar.xz
go-tangerine-02aa86e6591d4a70f152d8dc579df25e9aa0cd12.tar.zst
go-tangerine-02aa86e6591d4a70f152d8dc579df25e9aa0cd12.zip
eth/downloader: exit loop when there is no more available task
Diffstat (limited to 'eth/downloader/downloader.go')
-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 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.