diff --git a/ant-networking/src/transport.rs b/ant-networking/src/transport.rs index d452560301..63e0f83fc0 100644 --- a/ant-networking/src/transport.rs +++ b/ant-networking/src/transport.rs @@ -14,6 +14,8 @@ use libp2p::{ PeerId, Transport as _, }; +const MAX_STREAM_DATA_ENV_STR: &str = "ANT_MAX_STREAM_DATA"; + pub(crate) fn build_transport( keypair: &Keypair, #[cfg(feature = "open-metrics")] registries: &mut MetricsRegistries, @@ -30,5 +32,18 @@ pub(crate) fn build_transport( fn generate_quic_transport( keypair: &Keypair, ) -> libp2p::quic::GenTransport { - libp2p::quic::tokio::Transport::new(libp2p::quic::Config::new(keypair)) + let mut quic_config = libp2p::quic::Config::new(keypair); + if let Ok(val) = std::env::var(MAX_STREAM_DATA_ENV_STR) { + match val.parse::() { + Ok(val) => { + quic_config.max_stream_data = val; + tracing::info!("Overriding QUIC connection receive window value to {val}"); + } + Err(e) => { + tracing::warn!("QUIC connection receive window value override failed. Could not parse `{MAX_STREAM_DATA_ENV_STR}={val}` as integer: {e}") + } + } + } + + libp2p::quic::tokio::Transport::new(quic_config) }