mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-23 23:01:33 +00:00
fix(mdns): Don't expire mDNS nodes on connection close (#3367)
mDNS records should not be expiring when an unrelated connection timeout with said peer is reached. Fixes #3309.
This commit is contained in:
@ -28,7 +28,7 @@ use crate::Config;
|
||||
use futures::Stream;
|
||||
use if_watch::IfEvent;
|
||||
use libp2p_core::{Multiaddr, PeerId};
|
||||
use libp2p_swarm::behaviour::{ConnectionClosed, FromSwarm};
|
||||
use libp2p_swarm::behaviour::FromSwarm;
|
||||
use libp2p_swarm::{
|
||||
dummy, ListenAddresses, NetworkBehaviour, NetworkBehaviourAction, PollParameters,
|
||||
THandlerOutEvent,
|
||||
@ -199,22 +199,14 @@ where
|
||||
self.listen_addresses.on_swarm_event(&event);
|
||||
|
||||
match event {
|
||||
FromSwarm::ConnectionClosed(ConnectionClosed {
|
||||
peer_id,
|
||||
remaining_established,
|
||||
..
|
||||
}) => {
|
||||
if remaining_established == 0 {
|
||||
self.expire_node(&peer_id);
|
||||
}
|
||||
}
|
||||
FromSwarm::NewListener(_) => {
|
||||
log::trace!("waking interface state because listening address changed");
|
||||
for iface in self.iface_states.values_mut() {
|
||||
iface.fire_timer();
|
||||
}
|
||||
}
|
||||
FromSwarm::ConnectionEstablished(_)
|
||||
FromSwarm::ConnectionClosed(_)
|
||||
| FromSwarm::ConnectionEstablished(_)
|
||||
| FromSwarm::DialFailure(_)
|
||||
| FromSwarm::AddressChange(_)
|
||||
| FromSwarm::ListenFailure(_)
|
||||
|
Reference in New Issue
Block a user