diff options
author | obscuren <geffobscura@gmail.com> | 2015-04-19 02:25:55 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-04-19 02:25:55 +0800 |
commit | 6830ddb659270b59b5a310fdc0e581b09fae5326 (patch) | |
tree | 00d2c3a01e7af66741239ba806d824f2bba9de62 /eth/downloader/peer.go | |
parent | 7c5d50f627b223a8b0217f6ca684b4c7d1d877ef (diff) | |
download | dexon-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/peer.go')
-rw-r--r-- | eth/downloader/peer.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/eth/downloader/peer.go b/eth/downloader/peer.go index 5d5208e8e..ec2a61550 100644 --- a/eth/downloader/peer.go +++ b/eth/downloader/peer.go @@ -20,6 +20,12 @@ type blockFetcherFn func([]common.Hash) error // XXX make threadsafe!!!! type peers map[string]*peer +func (p peers) reset() { + for _, peer := range p { + p.reset() + } +} + func (p peers) get(state int) []*peer { var peers []*peer for _, peer := range p { @@ -128,3 +134,7 @@ func (p *peer) demote() { p.rep = 0 } } + +func (p *peer) reset() { + p.state = idleState +} |