libp2p / go-libp2p-kbucket

A kbucket implementation for use as a routing table
MIT License
48 stars 35 forks source link

Perform insertion, removal etc of peers in a single event loop in the RT #60

Open aarshkshah1992 opened 4 years ago

aarshkshah1992 commented 4 years ago

We need to move the code that listens for various events (PeerProtocolUpdated, PeerDisconnected/Connected etc etc) into a single event loop inside the Routing Table.

There's no reason to keep it in the DHT since we eventually want the RT to be a self sustaining data structure. This will also help prevent race conditions that arise in managing the RT/replacement-cache & make the code easy to reason about.

Once https://github.com/libp2p/go-libp2p/issues/801 goes in, we only need to depend on the event bus for all the relevant events & so will not have to depend on the host.

aarshkshah1992 commented 4 years ago

ping @Stebalien @raulk @aschmahmann .