Merge pull request #2265 from fjl/downloader-mem

eth/downloader: fix header download limiting
This commit is contained in:
Jeffrey Wilcke 2016-02-26 16:02:28 +01:00
commit 85865a51b6

View File

@ -1249,7 +1249,7 @@ func (d *Downloader) fetchHeaders(p *peer, td *big.Int, from uint64) error {
} }
} }
// Notify the content fetchers of new headers, but stop if queue is full // Notify the content fetchers of new headers, but stop if queue is full
cont := d.queue.PendingBlocks() < maxQueuedHeaders || d.queue.PendingReceipts() < maxQueuedHeaders cont := d.queue.PendingBlocks() < maxQueuedHeaders && d.queue.PendingReceipts() < maxQueuedHeaders
for _, ch := range []chan bool{d.bodyWakeCh, d.receiptWakeCh, d.stateWakeCh} { for _, ch := range []chan bool{d.bodyWakeCh, d.receiptWakeCh, d.stateWakeCh} {
if cont { if cont {
// We still have headers to fetch, send continuation wake signal (potential) // We still have headers to fetch, send continuation wake signal (potential)