lunatic_distributed/quic/
mod.rs1mod quin;
2
3use std::{net::SocketAddr, time::Duration};
4
5pub use quin::*;
6
7pub async fn try_connect_forever(
8 quic_client: &self::Client,
9 addr: SocketAddr,
10 name: &str,
11) -> (self::SendStream, self::RecvStream) {
12 loop {
13 log::info!("Connecting to node {addr} - {name}");
14 if let Ok(connection) = quic_client.connect(addr, name, 1).await {
15 return connection;
16 }
17 log::warn!("Failed to connect to node {addr} - {name}, retrying...");
18 tokio::time::sleep(Duration::from_secs(2)).await;
19 }
20}