From 8f92b4ad7e0a03f9eed15279aaf2a032df15e157 Mon Sep 17 00:00:00 2001 From: Roland Sherwin Date: Sat, 11 Jan 2025 00:32:19 +0530 Subject: [PATCH] feat(network): increase quic handshake timeout --- ant-networking/src/transport.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ant-networking/src/transport.rs b/ant-networking/src/transport.rs index 63e0f83fc0..cd6a4f8712 100644 --- a/ant-networking/src/transport.rs +++ b/ant-networking/src/transport.rs @@ -13,6 +13,10 @@ use libp2p::{ identity::Keypair, PeerId, Transport as _, }; +use std::time::Duration; + +/// The timeout for the QUIC handshake. This prevents the HandshakeTimedOut errors on connections. +const QUIC_HANDSHAKE_TIMEOUT: Duration = Duration::from_secs(10); const MAX_STREAM_DATA_ENV_STR: &str = "ANT_MAX_STREAM_DATA"; @@ -33,6 +37,8 @@ fn generate_quic_transport( keypair: &Keypair, ) -> libp2p::quic::GenTransport { let mut quic_config = libp2p::quic::Config::new(keypair); + quic_config.handshake_timeout = QUIC_HANDSHAKE_TIMEOUT; + if let Ok(val) = std::env::var(MAX_STREAM_DATA_ENV_STR) { match val.parse::() { Ok(val) => {