Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions rs/moq-quic/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2848,10 +2848,10 @@ impl Connection {
.exempt_probes
.filter(|&(since, _)| acked < since)
.unwrap_or((now, 0));
if count < limit {
// A reservation still waiting to leave, as behind a stalled socket, already covers this.
if count < limit && self.spaces[space].loss_probes == 0 {
self.exempt_probes = Some((since, count + 1));
let space = &mut self.spaces[space];
space.loss_probes = space.loss_probes.max(1);
self.spaces[space].loss_probes = 1;
}
self.timers.set(Timer::KeepAlive, now.saturating_add(after));
}
Expand Down Expand Up @@ -4652,6 +4652,12 @@ impl Connection {
self.prev_path.is_some()
}

/// How many keep-alive probes past the congestion window count against the current budget
#[cfg(test)]
pub(crate) fn exempt_probes_spent(&self) -> u32 {
self.exempt_probes.map_or(0, |(_, count)| count)
}

/// Bytes in flight on the current path, and its congestion window
#[cfg(test)]
pub(crate) fn in_flight_and_window(&self) -> (u64, u64) {
Expand Down
17 changes: 17 additions & 0 deletions rs/moq-quic/src/tests/keep_alive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,23 @@ fn unacknowledging_peer_keeps_probes_within_the_window() {
assert!(excess <= bound, "{excess} bytes past the window, past {bound}");
}

/// A probe still waiting to leave, as behind a stalled socket, spends the exempt budget once
/// however many times the keep-alive fires before it goes
#[test]
fn unsent_probe_spends_the_budget_once() {
let _guard = subscribe();
let (mut pair, client_ch, _) = connect();
pair.drive();
let until = pair.time.saturating_add(SOFT / 2 * 3 + Duration::from_millis(100));
let conn = pair.client_conn_mut(client_ch);
// Nothing transmits, so the first probe's reservation stays unsent through three firings.
while let Some(at) = conn.poll_timeout().filter(|&at| at <= until) {
conn.handle_timeout(at);
}
assert!(!conn.is_closed());
assert_eq!(conn.exempt_probes_spent(), 1);
}

/// Anyone on the path can send a Version Negotiation packet, so one says nothing of the peer and
/// leaves a stale session stale
#[test]
Expand Down