Commit 3630432d authored by Péter Szilágyi's avatar Péter Szilágyi Committed by Felix Lange

p2p/discovery: fix a cornercase loop if no seeds or bootnodes are known

parent f539ed1e
......@@ -278,12 +278,16 @@ 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
all := tab.bondall(append(tab.nursery, seeds...))
tab.mutex.Lock()
tab.add(all)
tab.mutex.Unlock()
tab.Lookup(tab.self.ID)
if len(peers) > 0 {
tab.mutex.Lock()
tab.add(peers)
tab.mutex.Unlock()
tab.Lookup(tab.self.ID)
}
// TODO: the Kademlia paper says that we're supposed to perform
// random lookups in all buckets further away than our closest neighbor.
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment