diff --git a/dht-cache/src/domocache.rs b/dht-cache/src/domocache.rs index 5246e2b..61c618d 100644 --- a/dht-cache/src/domocache.rs +++ b/dht-cache/src/domocache.rs @@ -410,13 +410,13 @@ impl DomoCache { } SwarmEvent::ConnectionEstablished { peer_id, connection_id, endpoint, .. } => { println!("Connection established {peer_id:?}, {connection_id:?}, {endpoint:?}"); - self.swarm - .behaviour_mut() - .gossipsub - .add_explicit_peer(&peer_id); + // self.swarm + // .behaviour_mut() + // .gossipsub + // .add_explicit_peer(&peer_id); } SwarmEvent::ConnectionClosed { peer_id, connection_id, endpoint, num_established: _, cause } => { - log::info!("Connection closed {peer_id:?}, {connection_id:?}, {endpoint:?} -> {cause:?}"); + println!("Connection closed {peer_id:?}, {connection_id:?}, {endpoint:?} -> {cause:?}"); } SwarmEvent::ListenerError { listener_id, error } => { log::warn!("Listener Error {listener_id:?} -> {error:?}"); @@ -460,7 +460,8 @@ impl DomoCache { let local = OffsetDateTime::now_utc(); for (peer, _) in list { - log::info!("MDNS for peer {peer} expired {local:?}"); + println!("MDNS for peer {peer} expired {local:?}"); + self.swarm.behaviour_mut().gossipsub.remove_explicit_peer(&peer); } } SwarmEvent::Behaviour(crate::domolibp2p::OutEvent::Mdns( diff --git a/dht-cache/src/domolibp2p.rs b/dht-cache/src/domolibp2p.rs index 3d31e16..809474b 100644 --- a/dht-cache/src/domolibp2p.rs +++ b/dht-cache/src/domolibp2p.rs @@ -129,7 +129,7 @@ pub async fn start( Ok(behaviour) })? - .with_swarm_config(|c| c.with_idle_connection_timeout(Duration::from_secs(2 * crate::domocache::SEND_CACHE_HASH_PERIOD as u64))) + .with_swarm_config(|c| c.with_idle_connection_timeout(Duration::from_secs(1))) .build();