From 14ad71805da56b367fb78a80e5ec61737d0b95c4 Mon Sep 17 00:00:00 2001 From: metah3m Date: Fri, 14 Feb 2025 11:34:40 +0800 Subject: [PATCH] feat: update congestion algorithm and set socket buffer size --- qconnection/src/builder.rs | 2 +- qudp/src/unix.rs | 1 + qudp/src/windows.rs | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/qconnection/src/builder.rs b/qconnection/src/builder.rs index a2689d80..b3e57f06 100644 --- a/qconnection/src/builder.rs +++ b/qconnection/src/builder.rs @@ -463,7 +463,7 @@ impl Components { let max_ack_delay = self.parameters.local()?.max_ack_delay().into_inner(); let cc = ArcCC::new( - CongestionAlgorithm::Bbr, + CongestionAlgorithm::NewReno, Duration::from_micros(max_ack_delay as _), [ self.spaces.initial().clone(), diff --git a/qudp/src/unix.rs b/qudp/src/unix.rs index 30b3fb3c..168d1c79 100644 --- a/qudp/src/unix.rs +++ b/qudp/src/unix.rs @@ -47,6 +47,7 @@ impl Io for UdpSocketController { let addr = io.local_addr()?; let is_ipv4 = addr.family() == libc::AF_INET as libc::sa_family_t; + self.setsockopt(libc::SOL_SOCKET, libc::SO_RCVBUF, 2 * 1024 * 1024); if is_ipv4 || !io.only_v6()? { // If enabled, the IP_TOS ancillary message is passed with // incoming packets. It contains a byte which specifies the diff --git a/qudp/src/windows.rs b/qudp/src/windows.rs index b60f51ec..7e73588a 100644 --- a/qudp/src/windows.rs +++ b/qudp/src/windows.rs @@ -89,6 +89,7 @@ impl Io for UdpSocketController { let is_ipv6 = addr.is_ipv6(); let is_ipv4 = addr.is_ipv4(); + self.setsockopt(WinSock::SOL_SOCKET, WinSock::SO_RCVBUF, 2 * 1024 * 1024); if is_ipv4 { self.setsockopt(WinSock::IPPROTO_IP, WinSock::IP_RECVTOS, OPTION_ON); self.setsockopt(WinSock::IPPROTO_IP, WinSock::IP_PKTINFO, OPTION_ON);