Replies: 1 comment
-
Not quite. Only once it established an out- or inbound stream, in other words only after it learned that the remote speaks the Kademlia protocol. See code paths around rust-libp2p/protocols/kad/src/handler.rs Lines 215 to 222 in 9e62588 I suggest keeping |
Beta Was this translation helpful? Give feedback.
-
Been reviewing and going over libp2p for a bit and something ive done for awhile was adding a peer to kad upon receiving the identify event and checking to see if they support kademlia protocol, however after testing and reviewing the protocol itself, I think this segment of code is not needed since it looks like the protocol will add the peer to to the routing table upon connection, assuming the configuration has
KademliaBucketInserts::OnConnected
set. IfKademliaBucketInserts::Manual
is set, I would have to manually add the peer if they are routable.So my question is, when is it ever appropriate or necessary to add the peer upon receiving the identify event and checking for the protocol? From my understanding, I could simply do this on receiving
KademliaEvent::RoutablePeer
andKademliaEvent::PendingRoutablePeer
event if im manually adding them or if im doing it on connection, let the protocol handle it and handle adding them manually if the bucket is full.Beta Was this translation helpful? Give feedback.
All reactions