mirror of https://github.com/ospab/ostp.git
fix: integrate BBR cwnd for bufferbloat and relax mobile timeouts
This commit is contained in:
parent
9c59cabfc7
commit
abcb8999ce
|
|
@ -446,7 +446,7 @@ impl Bridge {
|
||||||
_ = keepalive_tick.tick() => {
|
_ = keepalive_tick.tick() => {
|
||||||
if self.running {
|
if self.running {
|
||||||
// 1. Connection Liveness Check & Silent Background Reconnect
|
// 1. Connection Liveness Check & Silent Background Reconnect
|
||||||
if self.last_valid_recv.elapsed().as_secs() > 8 {
|
if self.last_valid_recv.elapsed().as_secs() > 25 {
|
||||||
let elapsed = self.last_valid_recv.elapsed().as_secs();
|
let elapsed = self.last_valid_recv.elapsed().as_secs();
|
||||||
if elapsed > 180 {
|
if elapsed > 180 {
|
||||||
// Hard timeout after 3 minutes of total silence
|
// Hard timeout after 3 minutes of total silence
|
||||||
|
|
@ -591,7 +591,7 @@ 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
|
||||||
s.iter().all(|ses| ses.machine.in_flight_count() < 256)
|
s.iter().all(|ses| ses.machine.in_flight_count() < ses.machine.cwnd_packets().clamp(16, 256))
|
||||||
}).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() {
|
||||||
|
|
|
||||||
|
|
@ -154,6 +154,10 @@ impl ProtocolMachine {
|
||||||
self.sent_history.iter().filter(|f| f.is_retransmittable).count()
|
self.sent_history.iter().filter(|f| f.is_retransmittable).count()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn cwnd_packets(&self) -> usize {
|
||||||
|
self.cc.cwnd_packets() as usize
|
||||||
|
}
|
||||||
|
|
||||||
pub fn state(&self) -> OstpState {
|
pub fn state(&self) -> OstpState {
|
||||||
self.state
|
self.state
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -464,7 +464,7 @@ async fn run_server_loop(
|
||||||
let mut last_empty_app_log = Instant::now() - Duration::from_secs(10);
|
let mut last_empty_app_log = Instant::now() - Duration::from_secs(10);
|
||||||
let mut peer_last_seen: HashMap<IpAddr, Instant> = HashMap::new();
|
let mut peer_last_seen: HashMap<IpAddr, Instant> = HashMap::new();
|
||||||
let mut peer_available: HashMap<IpAddr, bool> = HashMap::new();
|
let mut peer_available: HashMap<IpAddr, bool> = HashMap::new();
|
||||||
let peer_timeout = Duration::from_secs(15);
|
let peer_timeout = Duration::from_secs(45);
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
tokio::select! {
|
tokio::select! {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue