mirror of
https://gitlab.com/pulsechaincom/go-pulse.git
synced 2025-01-18 16:14:12 +00:00
p2p/discovery: fix a cornercase loop if no seeds or bootnodes are known
This commit is contained in:
parent
f539ed1e66
commit
3630432dfb
@ -278,12 +278,16 @@ func (tab *Table) refresh() {
|
|||||||
for _, seed := range seeds {
|
for _, seed := range seeds {
|
||||||
glog.V(logger.Debug).Infoln("Seeding network with", seed)
|
glog.V(logger.Debug).Infoln("Seeding network with", seed)
|
||||||
}
|
}
|
||||||
|
peers := append(tab.nursery, seeds...)
|
||||||
|
|
||||||
// Bootstrap the table with a self lookup
|
// Bootstrap the table with a self lookup
|
||||||
all := tab.bondall(append(tab.nursery, seeds...))
|
if len(peers) > 0 {
|
||||||
tab.mutex.Lock()
|
tab.mutex.Lock()
|
||||||
tab.add(all)
|
tab.add(peers)
|
||||||
tab.mutex.Unlock()
|
tab.mutex.Unlock()
|
||||||
tab.Lookup(tab.self.ID)
|
|
||||||
|
tab.Lookup(tab.self.ID)
|
||||||
|
}
|
||||||
// TODO: the Kademlia paper says that we're supposed to perform
|
// TODO: the Kademlia paper says that we're supposed to perform
|
||||||
// random lookups in all buckets further away than our closest neighbor.
|
// random lookups in all buckets further away than our closest neighbor.
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user