aboutsummaryrefslogtreecommitdiffstats
path: root/eth/downloader/queue.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-04-18 21:14:12 +0800
committerobscuren <geffobscura@gmail.com>2015-04-18 21:14:12 +0800
commit8244825bbf9ca7342c052508f50a56b16c979a1e (patch)
tree03f53ddc58bafbbed99280a876929a98df3de1fd /eth/downloader/queue.go
parenteef4776b5bb9d77a0dab0d9ac8da61fdbc72129f (diff)
downloaddexon-8244825bbf9ca7342c052508f50a56b16c979a1e.tar.gz
dexon-8244825bbf9ca7342c052508f50a56b16c979a1e.tar.zst
dexon-8244825bbf9ca7342c052508f50a56b16c979a1e.zip
downloader: reset the queue if a peer response with an empty hash set
Diffstat (limited to 'eth/downloader/queue.go')
-rw-r--r--eth/downloader/queue.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/eth/downloader/queue.go b/eth/downloader/queue.go
index 4d1aa4e93..df3bf7087 100644
--- a/eth/downloader/queue.go
+++ b/eth/downloader/queue.go
@@ -31,6 +31,17 @@ func newqueue() *queue {
}
}
+func (c *queue) reset() {
+ c.mu.Lock()
+ defer c.mu.Unlock()
+
+ c.hashPool.Clear()
+ c.fetchPool.Clear()
+ c.blockHashes.Clear()
+ c.blocks = nil
+ c.fetching = make(map[string]*chunk)
+}
+
// reserve a `max` set of hashes for `p` peer.
func (c *queue) get(p *peer, max int) *chunk {
c.mu.Lock()