Skip to content

Commit

Permalink
feat(network): increase quic handshake timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
RolandSherwin committed Jan 10, 2025
1 parent 98bc1b3 commit 8f92b4a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ant-networking/src/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -33,6 +37,8 @@ fn generate_quic_transport(
keypair: &Keypair,
) -> libp2p::quic::GenTransport<libp2p::quic::tokio::Provider> {
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::<u32>() {
Ok(val) => {
Expand Down

0 comments on commit 8f92b4a

Please sign in to comment.