bufferbloat but high speed

This commit is contained in:
2026-04-06 14:43:04 +07:00
parent aa25030827
commit aa9234fc72
5 changed files with 27 additions and 29 deletions
+2 -2
View File
@@ -65,7 +65,7 @@ impl TcpConnection {
mpsc::Sender<Bytes>,
oneshot::Sender<()>,
) {
let capacity = NetworkConfig::global().client_stream_capacity;
let capacity = NetworkConfig::global().client_virtual_stream_capacity;
let (core, rx_from_smol, tx_to_smol) = ConnectionCore::new(handle, capacity);
let (handshake_tx, handshake_rx) = oneshot::channel();
@@ -253,7 +253,7 @@ impl UdpConnection {
client_addr: smoltcp::wire::IpAddress,
client_port: u16,
) -> (Self, mpsc::Receiver<UdpPacketTarget>, mpsc::Sender<Bytes>) {
let capacity = NetworkConfig::global().client_stream_capacity;
let capacity = NetworkConfig::global().client_virtual_stream_capacity;
let (core, rx_from_smol, tx_to_smol) = ConnectionCore::new(handle, capacity);
let conn = Self {
+12 -4
View File
@@ -1,7 +1,11 @@
use netrunner_core::net::NetworkConfig;
use smoltcp::{
iface::SocketSet,
socket::{icmp, tcp, udp},
socket::{
icmp,
tcp::{self, CongestionControl},
udp,
},
time::Duration,
wire::{IpAddress, IpListenEndpoint},
};
@@ -16,7 +20,7 @@ pub enum TrafficProfile {
}
pub const TCP_SOCKET_KEEP_ALIVE: Duration = Duration::from_secs(15);
pub const TCP_SOCKET_ACTIVE_TIMEOUT: Duration = Duration::from_secs(20);
pub const TCP_SOCKET_ACTIVE_TIMEOUT: Duration = Duration::from_secs(60);
impl TrafficProfile {
pub fn guess_from_port(port: u16, is_tcp: bool) -> Self {
@@ -83,12 +87,16 @@ impl SocketProvider for SmolSocketFactory {
socket.set_nagle_enabled(false);
socket.set_ack_delay(None);
}
TrafficProfile::Bulk | TrafficProfile::Default => {
TrafficProfile::Bulk => {
socket.set_nagle_enabled(false);
socket.set_ack_delay(Some(Duration::from_millis(15)));
}
_ => {
socket.set_nagle_enabled(false);
socket.set_ack_delay(None);
}
_ => {}
}
socket.set_congestion_control(CongestionControl::Cubic);
}
fn create_udp(&self, profile: TrafficProfile) -> udp::Socket<'static> {