From 8898bcd9a9e6c69f272366aaa55269dcd13128c0 Mon Sep 17 00:00:00 2001 From: Mingwei Tian Date: Sat, 25 Mar 2023 13:36:10 -0700 Subject: [PATCH] More tolerant congestion control --- crates/anemo/src/config.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/anemo/src/config.rs b/crates/anemo/src/config.rs index 2d1ef12..6ec4fab 100644 --- a/crates/anemo/src/config.rs +++ b/crates/anemo/src/config.rs @@ -3,7 +3,7 @@ use crate::{ PeerId, Result, }; use pkcs8::EncodePrivateKey; -use quinn::VarInt; +use quinn::{congestion, VarInt}; use rcgen::{CertificateParams, KeyPair, SignatureAlgorithm}; use serde::{Deserialize, Serialize}; use std::{sync::Arc, time::Duration}; @@ -342,6 +342,12 @@ impl QuicConfig { config.keep_alive_interval(Some(keep_alive_interval)); } + let mut cc_config = congestion::NewRenoConfig::default(); + cc_config.loss_reduction_factor(0.7); + cc_config.initial_window(4 << 20); + cc_config.minimum_window(1 << 20); + config.congestion_controller_factory(Arc::new(cc_config)); + config } }