aboutsummaryrefslogtreecommitdiffstats
path: root/eth/downloader/downloader.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-04-19 02:25:55 +0800
committerobscuren <geffobscura@gmail.com>2015-04-19 02:25:55 +0800
commit6830ddb659270b59b5a310fdc0e581b09fae5326 (patch)
tree00d2c3a01e7af66741239ba806d824f2bba9de62 /eth/downloader/downloader.go
parent7c5d50f627b223a8b0217f6ca684b4c7d1d877ef (diff)
downloaddexon-6830ddb659270b59b5a310fdc0e581b09fae5326.tar
dexon-6830ddb659270b59b5a310fdc0e581b09fae5326.tar.gz
dexon-6830ddb659270b59b5a310fdc0e581b09fae5326.tar.bz2
dexon-6830ddb659270b59b5a310fdc0e581b09fae5326.tar.lz
dexon-6830ddb659270b59b5a310fdc0e581b09fae5326.tar.xz
dexon-6830ddb659270b59b5a310fdc0e581b09fae5326.tar.zst
dexon-6830ddb659270b59b5a310fdc0e581b09fae5326.zip
downloader: free up peers from work when the downloader resets
Diffstat (limited to 'eth/downloader/downloader.go')
-rw-r--r--eth/downloader/downloader.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/eth/downloader/downloader.go b/eth/downloader/downloader.go
index 2b5dbe952..2f98a1414 100644
--- a/eth/downloader/downloader.go
+++ b/eth/downloader/downloader.go
@@ -297,8 +297,9 @@ out:
// make sure that we have peers available for fetching. If all peers have been tried
// and all failed throw an error
- if len(availablePeers) > 0 && d.queue.fetchPool.Size() == 0 {
+ if len(d.queue.fetching) == 0 {
d.queue.reset()
+ d.peers.reset()
return errPeersUnavailable
}
@@ -337,6 +338,7 @@ out:
d.queue.deliver(pid, nil)
if peer := d.peers[pid]; peer != nil {
peer.demote()
+ peer.reset()
}
}