mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-05-04 07:02:16 +00:00
Given the following scenario: 1. Remote peer X connects and is added to `connected_peers`. 2. Remote peer X opens a Kademlia substream and thus confirms that it supports the Kademlia protocol. 3. Remote peer X is added to the routing table as `Connected`. 4. Remote peer X disconnects and is thus marked as `Disconnected` in the routing table. 5. Remote peer Y connects and is added to `connected_peers`. 6. Remote peer X re-connects and is added to `connected_peers`. 7. Remote peer Y opens a Kademlia substream and thus confirms that it supports the Kademlia protocol. 8. Remote peer Y is added to the routing table. Given that the bucket is already full the call to `entry.insert` returns `kbucket::InsertResult::Pending { disconnected }` where disconnected is peer X. While peer X is in `connected_peers` it has not yet (re-) confirmed that it supports the Kademlia routing protocol and thus is still tracked as `Disconnected` in the routing table. The `debug_assert` removed in this pull request does not capture this scenario.