]> git.bitcoin.ninja Git - rapid-gossip-sync-server/commitdiff
Call `PeerManager::timer_tick_occurred` regularly to ping peers
authorMatt Corallo <git@bluematt.me>
Wed, 8 Feb 2023 16:59:09 +0000 (16:59 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 15 Mar 2023 17:52:43 +0000 (17:52 +0000)
src/tracking.rs

index 0f34924ed9458f5618014bf785c7fb382789dae0..ebe04134a91d43e42d284459404a83a5898008d6 100644 (file)
@@ -50,6 +50,15 @@ pub(crate) async fn download_gossip(persistence_sender: mpsc::Sender<GossipMessa
        ));
        router.set_pm(Arc::clone(&peer_handler));
 
+       let ph_timer = Arc::clone(&peer_handler);
+       tokio::spawn(async move {
+               let mut intvl = tokio::time::interval(Duration::from_secs(10));
+               loop {
+                       intvl.tick().await;
+                       ph_timer.timer_tick_occurred();
+               }
+       });
+
        println!("Connecting to Lightning peers...");
        let peers = config::ln_peers();
        let mut connected_peer_count = 0;