Skip to content

Kind of do tail-loss probes correctly #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 11, 2025
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
20 changes: 14 additions & 6 deletions quinn-proto/src/connection/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{
cmp,
collections::VecDeque,
collections::{BTreeSet, VecDeque},
convert::TryFrom,
fmt, io, mem,
net::{IpAddr, SocketAddr},
Expand Down Expand Up @@ -525,11 +525,12 @@ impl Connection {
}

// If we need to send a probe, make sure we have something to send.
for space in SpaceId::iter() {
let request_immediate_ack =
space == SpaceId::Data && self.peer_supports_ack_frequency();
self.spaces[space].maybe_queue_probe(request_immediate_ack, &self.streams);
}
self.spaces[SpaceId::Initial].maybe_queue_probe(PathId(0), false, &self.streams);
self.spaces[SpaceId::Handshake].maybe_queue_probe(PathId(0), false, &self.streams);

// For the data paths we need to call maybe_queue_probe once for each path. This
// keeps track if it was already done for a path.
let mut data_tail_probes: BTreeSet<PathId> = BTreeSet::new();

// Check whether we need to send a close message
let close = match self.state {
Expand Down Expand Up @@ -581,6 +582,13 @@ impl Connection {
while space_idx < spaces.len() {
let space_id = spaces[space_idx];

// If we need to send a tail-loss probe, make sure there is something to send.
if space_id == SpaceId::Data && !data_tail_probes.contains(&path_id) {
let immediate_ack = self.peer_supports_ack_frequency();
self.spaces[space_id].maybe_queue_probe(path_id, immediate_ack, &self.streams);
data_tail_probes.insert(path_id);
}

// Number of bytes available for frames if this is a 1-RTT packet. We're guaranteed to
// be able to send an individual frame at least this large in the next 1-RTT
// packet. This could be generalized to support every space, but it's only needed to
Expand Down
4 changes: 3 additions & 1 deletion quinn-proto/src/connection/spaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,11 @@ impl PacketSpace {
// might be lost.
pub(super) fn maybe_queue_probe(
&mut self,
path_id: PathId,
request_immediate_ack: bool,
streams: &StreamsState,
) {
if self.number_spaces.values().all(|s| s.loss_probes == 0) {
if self.for_path(path_id).loss_probes == 0 {
return;
}

Expand All @@ -133,6 +134,7 @@ impl PacketSpace {
return;
}

// We use retransmits from any path.
for packet in self
.number_spaces
.values_mut()
Expand Down
Loading