Skip to content

Commit 612f014

Browse files
karalabefjl
authored andcommitted
p2p/discover: bond with seed nodes too (runs only if findnode failed)
1 parent 3630432 commit 612f014

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

p2p/discover/table.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -278,14 +278,11 @@ func (tab *Table) refresh() {
278278
for _, seed := range seeds {
279279
glog.V(logger.Debug).Infoln("Seeding network with", seed)
280280
}
281-
peers := append(tab.nursery, seeds...)
282-
283-
// Bootstrap the table with a self lookup
284-
if len(peers) > 0 {
285-
tab.mutex.Lock()
286-
tab.add(peers)
287-
tab.mutex.Unlock()
281+
nodes := append(tab.nursery, seeds...)
288282

283+
// Bond with all the seed nodes (will pingpong only if failed recently)
284+
bonded := tab.bondall(nodes)
285+
if len(bonded) > 0 {
289286
tab.Lookup(tab.self.ID)
290287
}
291288
// TODO: the Kademlia paper says that we're supposed to perform

0 commit comments

Comments
 (0)