From 6a4f51555b28fee3f00a2f7e48043c6ee7a59189 Mon Sep 17 00:00:00 2001 From: Lee Smet Date: Thu, 26 Mar 2026 17:35:12 +0100 Subject: [PATCH] Mirror quic config on outgoing and inbound connections Signed-off-by: Lee Smet --- CHANGELOG.md | 2 ++ mycelium/src/peer_manager.rs | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2e9181..f42abe0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 working. This should improve route acquisition after spurious network interrupts. - Route request cache now properly cleans and maintains entries to avoid sending duplicates to peers. +- Make sure the configuration for Quic connections is the same for outbound and + inbound connections. ## [0.7.4] - 2026-03-23 diff --git a/mycelium/src/peer_manager.rs b/mycelium/src/peer_manager.rs index 7c8912f..a75b687 100644 --- a/mycelium/src/peer_manager.rs +++ b/mycelium/src/peer_manager.rs @@ -669,7 +669,6 @@ where } }; let mut config = quinn::ClientConfig::new(Arc::new(qcc)); - // Todo: tweak transport config let mut transport_config = TransportConfig::default(); transport_config.max_concurrent_uni_streams(0_u8.into()); // Larger than needed for now, just in case @@ -679,10 +678,15 @@ where transport_config.max_idle_timeout(Some(Duration::from_secs(60).try_into().unwrap())); transport_config.mtu_discovery_config(Some(MtuDiscoveryConfig::default())); transport_config.keep_alive_interval(Some(Duration::from_secs(20))); - // we don't use datagrams. transport_config.datagram_receive_buffer_size(Some(16 << 20)); transport_config.datagram_send_buffer_size(16 << 20); transport_config.initial_mtu(1500); + transport_config.enable_segmentation_offload(true); + transport_config.send_window((8 * (10u32 << 20)).into()); + transport_config.stream_receive_window((10u32 << 20).into()); + let mut congestion_controller = congestion::CubicConfig::default(); + congestion_controller.initial_window(1 << 22); // 4MiB + transport_config.congestion_controller_factory(Arc::new(congestion_controller)); config.transport_config(Arc::new(transport_config)); match quic_socket.connect_with(config, endpoint.address(), "dummy.mycelium") { @@ -1296,7 +1300,7 @@ fn make_quic_endpoint( transport_config.stream_receive_window((10u32 << 20).into()); let mut congestion_controller = congestion::CubicConfig::default(); congestion_controller.initial_window(1 << 22); // 4MiB - // TODO: further tweak this. + transport_config.congestion_controller_factory(Arc::new(congestion_controller)); let socket = std::net::UdpSocket::bind(("::", quic_listen_port)) .and_then(|socket| set_fw_mark(socket, firewall_mark))?;