Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(networking): QUIC receive window override env #2605

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion ant-networking/src/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -30,5 +32,18 @@ pub(crate) fn build_transport(
fn generate_quic_transport(
keypair: &Keypair,
) -> libp2p::quic::GenTransport<libp2p::quic::tokio::Provider> {
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::<u32>() {
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)
}
Loading