mirror of https://github.com/ospab/ostp.git
fix: resolve deadlock, multiplexing backpressure, and LTE fragmentation issues
This commit is contained in:
parent
8771f17371
commit
c9fad99144
|
|
@ -617,8 +617,8 @@ impl Bridge {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
proxy_ev = proxy_rx.recv(), if self.running && sessions_opt.as_ref().map(|s| {
|
proxy_ev = proxy_rx.recv(), if self.running && sessions_opt.as_ref().map(|s| {
|
||||||
// Backpressure: suspend proxy reads when ARQ window is saturated
|
// Backpressure: suspend proxy reads when ARQ window is saturated across ALL sessions
|
||||||
s.iter().all(|ses| ses.machine.in_flight_count() < ses.machine.cwnd_packets().clamp(16, 16384))
|
s.iter().any(|ses| ses.machine.in_flight_count() < ses.machine.cwnd_packets().clamp(16, 16384))
|
||||||
}).unwrap_or(true) => {
|
}).unwrap_or(true) => {
|
||||||
if let Some(ev) = proxy_ev {
|
if let Some(ev) = proxy_ev {
|
||||||
if let Some(sessions) = sessions_opt.as_mut() {
|
if let Some(sessions) = sessions_opt.as_mut() {
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ pub struct OstpConfig {
|
||||||
|
|
||||||
fn default_keepalive() -> u64 { 5 }
|
fn default_keepalive() -> u64 { 5 }
|
||||||
|
|
||||||
fn default_mtu() -> usize { 1500 }
|
fn default_mtu() -> usize { 1140 }
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct LocalProxyConfig {
|
pub struct LocalProxyConfig {
|
||||||
|
|
|
||||||
|
|
@ -557,9 +557,6 @@ impl ProtocolMachine {
|
||||||
// Limit retransmits per tick to prevent bandwidth saturation
|
// Limit retransmits per tick to prevent bandwidth saturation
|
||||||
let mut retransmit_budget: usize = self.cc.retransmit_budget();
|
let mut retransmit_budget: usize = self.cc.retransmit_budget();
|
||||||
for frame in self.sent_history.iter_mut() {
|
for frame in self.sent_history.iter_mut() {
|
||||||
if retransmit_budget == 0 {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if !frame.is_retransmittable {
|
if !frame.is_retransmittable {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -571,10 +568,13 @@ impl ProtocolMachine {
|
||||||
if now.duration_since(frame.last_sent) >= effective_rto {
|
if now.duration_since(frame.last_sent) >= effective_rto {
|
||||||
frame.last_sent = now;
|
frame.last_sent = now;
|
||||||
frame.retries = frame.retries.saturating_add(1);
|
frame.retries = frame.retries.saturating_add(1);
|
||||||
|
|
||||||
|
if retransmit_budget > 0 {
|
||||||
actions.push(ProtocolAction::SendDatagram(frame.bytes.clone()));
|
actions.push(ProtocolAction::SendDatagram(frame.bytes.clone()));
|
||||||
retransmit_budget -= 1;
|
retransmit_budget -= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if actions.is_empty() {
|
if actions.is_empty() {
|
||||||
Ok(ProtocolAction::Noop)
|
Ok(ProtocolAction::Noop)
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,7 @@ class OstpVpnService : VpnService() {
|
||||||
.addRoute("0.0.0.0", 0)
|
.addRoute("0.0.0.0", 0)
|
||||||
.addRoute("::", 0)
|
.addRoute("::", 0)
|
||||||
.addDnsServer(dnsServer)
|
.addDnsServer(dnsServer)
|
||||||
.setMtu(json.optJSONObject("ostp")?.optInt("mtu", 1280) ?: 1280)
|
.setMtu(json.optJSONObject("ostp")?.optInt("mtu", 1140) ?: 1140)
|
||||||
|
|
||||||
try { builder.addDnsServer("8.8.8.8") } catch (e: Throwable) {}
|
try { builder.addDnsServer("8.8.8.8") } catch (e: Throwable) {}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue