Skip to content

Conversation

@denisbsu
Copy link
Contributor

No description provided.

@denisbsu denisbsu requested a review from kalabukdima January 26, 2026 13:12
fn on_dial_failure(&mut self, err: DialFailure) -> Option<TToSwarm<Self>> {
log::debug!("Dial failure: {err:?}");
match err.error {
libp2p::swarm::DialError::WrongPeerId { obtained: _, address: _ } |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just { .. }?

None => log::error!("Closed connection not established before"),
}
self.evict_from_cache(peer_id);
log::debug!("Disconnect: {conn:?}");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this left intentionally? If yes, can we have a clearer message?

libp2p::swarm::DialError::WrongPeerId { obtained: _, address: _ } |
libp2p::swarm::DialError::Transport(_) => {
if let Some(peer_id) = err.peer_id {
self.evict_from_cache(peer_id);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Swarm events are also sent to each inner behaviour I believe. Let's handle these events directly in the AddressCache behaviour to keep BaseBehaviour as simple as possible.

In case of Kademlia you have to bridge them like this because behaviours don't communicate with each other. But each behaviour communicates with the Swarm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants