aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2015-05-25 21:35:32 +0800
committerFelix Lange <fjl@twurst.com>2015-05-27 05:30:41 +0800
commit612f01400f59b0b4d0db9f9ceaa38f45805ea89e (patch)
tree3a48f803dcf36f67adbeec5bd9bf92902a34bf06
parent3630432dfb486a5bf8f853900be1fe32fefae182 (diff)
downloaddexon-612f01400f59b0b4d0db9f9ceaa38f45805ea89e.tar
dexon-612f01400f59b0b4d0db9f9ceaa38f45805ea89e.tar.gz
dexon-612f01400f59b0b4d0db9f9ceaa38f45805ea89e.tar.bz2
dexon-612f01400f59b0b4d0db9f9ceaa38f45805ea89e.tar.lz
dexon-612f01400f59b0b4d0db9f9ceaa38f45805ea89e.tar.xz
dexon-612f01400f59b0b4d0db9f9ceaa38f45805ea89e.tar.zst
dexon-612f01400f59b0b4d0db9f9ceaa38f45805ea89e.zip
p2p/discover: bond with seed nodes too (runs only if findnode failed)
-rw-r--r--p2p/discover/table.go11
1 files changed, 4 insertions, 7 deletions
diff --git a/p2p/discover/table.go b/p2p/discover/table.go
index 7bff0d1d0..4b7ddb775 100644
--- a/p2p/discover/table.go
+++ b/p2p/discover/table.go
@@ -278,14 +278,11 @@ func (tab *Table) refresh() {
for _, seed := range seeds {
glog.V(logger.Debug).Infoln("Seeding network with", seed)
}
- peers := append(tab.nursery, seeds...)
-
- // Bootstrap the table with a self lookup
- if len(peers) > 0 {
- tab.mutex.Lock()
- tab.add(peers)
- tab.mutex.Unlock()
+ nodes := append(tab.nursery, seeds...)
+ // Bond with all the seed nodes (will pingpong only if failed recently)
+ bonded := tab.bondall(nodes)
+ if len(bonded) > 0 {
tab.Lookup(tab.self.ID)
}
// TODO: the Kademlia paper says that we're supposed to perform