Merge pull request #14973 from rjl493456442/fix_downloader

eth/downloader: exit loop when there is no more available task
This commit is contained in:
Péter Szilágyi 2017-09-11 14:02:02 +03:00 committed by GitHub
commit c8e70186a6
1 changed files with 4 additions and 0 deletions

View File

@ -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.