diff --git a/network/src/peer_registry.rs b/network/src/peer_registry.rs index 9f3e55536b8..6d8cd27af0b 100644 --- a/network/src/peer_registry.rs +++ b/network/src/peer_registry.rs @@ -76,6 +76,7 @@ impl PeerRegistry { session_type: SessionType, peer_store: &mut PeerStore, ) -> Result, Error> { + debug!("start accept peer {:?}", session_id); if self.peers.contains_key(&session_id) { return Err(PeerError::SessionExists(session_id).into()); } @@ -112,6 +113,7 @@ impl PeerRegistry { peer_store.add_connected_peer(remote_addr.clone(), session_type); let peer = Peer::new(session_id, session_type, remote_addr, is_whitelist); self.peers.insert(session_id, peer); + debug!("end accept peer {:?}", session_id); Ok(evicted_peer) } diff --git a/network/src/services/dump_peer_store.rs b/network/src/services/dump_peer_store.rs index 735ace3a712..a36a2b35b66 100644 --- a/network/src/services/dump_peer_store.rs +++ b/network/src/services/dump_peer_store.rs @@ -7,7 +7,7 @@ use std::{ task::{Context, Poll}, time::Duration, }; -use tokio::time::{Instant, Interval, MissedTickBehavior}; +use tokio::time::{Interval, MissedTickBehavior}; const DEFAULT_DUMP_INTERVAL: Duration = Duration::from_secs(3600); // 1 hour @@ -50,10 +50,7 @@ impl Future for DumpPeerStoreService { fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { if self.interval.is_none() { self.interval = { - let mut interval = tokio::time::interval_at( - Instant::now() + DEFAULT_DUMP_INTERVAL, - DEFAULT_DUMP_INTERVAL, - ); + let mut interval = tokio::time::interval(DEFAULT_DUMP_INTERVAL); // The dump peer store service does not need to urgently compensate for the missed wake, // just delay behavior is enough interval.set_missed_tick_behavior(MissedTickBehavior::Delay);