diff --git a/zebra-network/src/peer/connector.rs b/zebra-network/src/peer/connector.rs index fd0f2e6d..2733cc23 100644 --- a/zebra-network/src/peer/connector.rs +++ b/zebra-network/src/peer/connector.rs @@ -4,12 +4,13 @@ use std::{ pin::Pin, sync::{Arc, Mutex}, task::{Context, Poll}, + time::Duration, }; use chrono::Utc; use futures::channel::mpsc; -use tokio::{codec::Framed, net::TcpStream, prelude::*}; -use tower::Service; +use tokio::{codec::Framed, net::TcpStream, prelude::*, timer::Interval}; +use tower::{Service, ServiceExt}; use tracing::{span, Level}; use tracing_futures::Instrument; @@ -18,8 +19,7 @@ use zebra_chain::types::BlockHeight; use crate::{ constants, protocol::{codec::*, internal::*, message::*, types::*}, - timestamp_collector::TimestampCollector, - types::{MetaAddr, Network}, + types::MetaAddr, BoxedStdError, Config, }; @@ -208,6 +208,13 @@ where .boxed(), ); + // client.ready().await?; + + tokio::spawn( + Interval::new_interval(Duration::from_secs(60)) + .for_each(|_| client.call(Request::Ping(Nonce::default()))), + ); + Ok(client) }; fut.instrument(connector_span).boxed()