paritytech / litep2p

Peer-to-peer networking library
MIT License
67 stars 8 forks source link

Implement proper peer eviction #37

Open altonen opened 6 months ago

altonen commented 6 months ago

Currently the routing table doesn't evict any peers if a bucket is full. Meaning if Kademlia tries to add a peer with an active connection to the routing table and it's full of disconnected peers, the new connected peer is rejected. Analyze how rust-libp2p deals with evictions and see if it can be applied to litep2p.

dmitry-markin commented 6 months ago

Isn't https://github.com/altonen/litep2p/blob/master/src/protocol/libp2p/kademlia/bucket.rs#L90-L97 responsible for replacing disconnected peers?

altonen commented 6 months ago

You're right, I had forgotten that check and only looked at routing_table.rs. But as discussed in Element, I believe the eviction is smarter in rust-libp2p and we should have something similar in litep2p as well.