aboutsummaryrefslogtreecommitdiffstats
path: root/eth/downloader/queue.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-05-13 01:05:33 +0800
committerobscuren <geffobscura@gmail.com>2015-05-13 01:05:33 +0800
commit8e24378cc1acb074b56de75bf0baf6feb7927677 (patch)
tree71f866652de6b45da5ad4403b88f5def9a684e36 /eth/downloader/queue.go
parent7d69679935ff8c04aebb60f27074f08c5e84ac95 (diff)
parent8fe01b4bfa28ad5a1fdde7f9837e8f982843389a (diff)
downloadgo-tangerine-0.9.20.tar
go-tangerine-0.9.20.tar.gz
go-tangerine-0.9.20.tar.bz2
go-tangerine-0.9.20.tar.lz
go-tangerine-0.9.20.tar.xz
go-tangerine-0.9.20.tar.zst
go-tangerine-0.9.20.zip
Merge branch 'release/0.9.20'v0.9.20
Diffstat (limited to 'eth/downloader/queue.go')
-rw-r--r--eth/downloader/queue.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/eth/downloader/queue.go b/eth/downloader/queue.go
index 515440bca..40749698c 100644
--- a/eth/downloader/queue.go
+++ b/eth/downloader/queue.go
@@ -1,3 +1,6 @@
+// Contains the block download scheduler to collect download tasks and schedule
+// them in an ordered, and throttled way.
+
package downloader
import (
@@ -8,6 +11,8 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
+ "github.com/ethereum/go-ethereum/logger"
+ "github.com/ethereum/go-ethereum/logger/glog"
"gopkg.in/karalabe/cookiejar.v2/collections/prque"
)
@@ -126,6 +131,10 @@ func (q *queue) Insert(hashes []common.Hash) {
for i, hash := range hashes {
index := q.hashCounter + i
+ if old, ok := q.hashPool[hash]; ok {
+ glog.V(logger.Warn).Infof("Hash %x already scheduled at index %v", hash, old)
+ continue
+ }
q.hashPool[hash] = index
q.hashQueue.Push(hash, float32(index)) // Highest gets schedules first
}