Commit 33ec247c authored by Adin Schmahmann's avatar Adin Schmahmann

reorder startup events so that everything but the refresh manager starts...

reorder startup events so that everything but the refresh manager starts before we add already connected peers to our routing table
parent cae3999e
......@@ -218,14 +218,21 @@ func New(ctx context.Context, h host.Host, options ...Option) (*IpfsDHT, error)
// handle providers
dht.proc.AddChild(dht.ProviderManager.Process())
dht.proc.Go(dht.populatePeers)
// go-routine to make sure we ALWAYS have RT peer addresses in the peerstore
// since RT membership is decoupled from connectivity
go dht.persistRTPeersInPeerStore()
dht.proc.Go(dht.rtPeerLoop)
// Fill routing table with currently connected peers that are DHT servers
dht.plk.Lock()
for _, p := range dht.host.Network().Peers() {
dht.peerFound(dht.ctx, p, false)
}
dht.plk.Unlock()
dht.proc.Go(dht.populatePeers)
return dht, nil
}
......
......@@ -56,13 +56,6 @@ func newSubscriberNotifiee(dht *IpfsDHT) (*subscriberNotifee, error) {
// register for network notifications
dht.host.Network().Notify(nn)
// Fill routing table with currently connected peers that are DHT servers
dht.plk.Lock()
defer dht.plk.Unlock()
for _, p := range dht.host.Network().Peers() {
dht.peerFound(dht.ctx, p, false)
}
return nn, nil
}
......
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