fix: resolve packet drop & connection timeouts under high speed tests by reducing proxy event queue size and expanding sent history / reorder buffers

This commit is contained in:
ospab 2026-05-17 01:35:24 +03:00
parent a46b6eb0b6
commit 4cc1f0079c
4 changed files with 12 additions and 12 deletions

10
Cargo.lock generated
View File

@ -745,7 +745,7 @@ checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381"
[[package]]
name = "ostp"
version = "0.1.52"
version = "0.1.53"
dependencies = [
"anyhow",
"base64",
@ -762,7 +762,7 @@ dependencies = [
[[package]]
name = "ostp-client"
version = "0.1.52"
version = "0.1.53"
dependencies = [
"anyhow",
"bytes",
@ -779,7 +779,7 @@ dependencies = [
[[package]]
name = "ostp-core"
version = "0.1.52"
version = "0.1.53"
dependencies = [
"anyhow",
"async-trait",
@ -812,7 +812,7 @@ dependencies = [
[[package]]
name = "ostp-server"
version = "0.1.52"
version = "0.1.53"
dependencies = [
"anyhow",
"bytes",
@ -826,7 +826,7 @@ dependencies = [
[[package]]
name = "ostp-tun-helper"
version = "0.1.52"
version = "0.1.53"
dependencies = [
"anyhow",
"chrono",

View File

@ -432,8 +432,8 @@ impl Bridge {
}
}
proxy_ev = proxy_rx.recv(), if self.running && sessions_opt.as_ref().map(|s| {
// §3 FIX: Apply backpressure. Suspend pulling from local proxy if ARQ buffers exceed 1024 unacked frames
s.iter().all(|ses| ses.machine.in_flight_count() < 1024)
// §3 FIX: Apply backpressure. Suspend pulling from local proxy if ARQ buffers exceed 512 unacked frames
s.iter().all(|ses| ses.machine.in_flight_count() < 512)
}).unwrap_or(true) => {
if let Some(ev) = proxy_ev {
if let Some(sessions) = sessions_opt.as_mut() {
@ -602,11 +602,11 @@ impl Bridge {
padding_strategy: PaddingStrategy::Profile(self.profile),
obfuscation_key: obf_key,
max_reorder: 262144,
max_reorder_buffer: 8192,
max_reorder_buffer: 32768, // Expanded to prevent dropping out-of-order packets during high-speed tests
ack_delay_ms: 5, // Reduced from 20ms to 5ms for rapid ACK unblocking and throughput acceleration
rto_ms: 100, // Reduced from 200ms to 100ms for faster recovery on packet loss
max_retries: 8,
max_sent_history: 16384,
max_sent_history: 65536, // Greatly expanded to guarantee that oldest unacked packets are not prematurely popped and lost
})?;
let socket = UdpSocket::bind(&self.local_bind_addr)

View File

@ -153,7 +153,7 @@ pub async fn run_client_core(
println!("[ostp-client] WARNING: process exclusions are not supported in the current TUN implementation");
}
let (proxy_events_tx, proxy_events_rx) = mpsc::channel(10000);
let (proxy_events_tx, proxy_events_rx) = mpsc::channel(256);
let (client_msgs_tx, client_msgs_rx) = mpsc::unbounded_channel();
let bridge = Bridge::new(&config, metrics)?;

View File

@ -126,11 +126,11 @@ pub async fn run_server(
padding_strategy: PaddingStrategy::Adaptive,
obfuscation_key: [0u8; 8],
max_reorder: 262144,
max_reorder_buffer: 8192,
max_reorder_buffer: 32768,
ack_delay_ms: 5, // Reduced to 5ms for drastically faster ACK loopback throughput
rto_ms: 100, // Reduced to 100ms for aggressive, low-latency packet recovery
max_retries: 8,
max_sent_history: 16384,
max_sent_history: 65536,
};
let dispatcher = Dispatcher::new(protocol_config, shared_keys.clone());