Skip to content

Commit 8765937

Browse files
committed
fix receiving a PATH_ABANDON closing the path on which it came from
The path could not exist anymore, so close the path at the very end when receiving a packet.
1 parent faae5ce commit 8765937

File tree

1 file changed

+47
-42
lines changed

1 file changed

+47
-42
lines changed

quiche/src/lib.rs

+47-42
Original file line numberDiff line numberDiff line change
@@ -3248,45 +3248,6 @@ impl Connection {
32483248
}
32493249
}
32503250

3251-
for path_id in self.path_id_to_abandon.drain(..) {
3252-
let (lost_packets, lost_bytes) = close_path(
3253-
&mut self.ids,
3254-
&mut self.pkt_num_spaces,
3255-
&mut self.paths,
3256-
path_id,
3257-
now,
3258-
&self.trace_id,
3259-
)?;
3260-
debug!("{} Close path succeeded", self.trace_id);
3261-
self.lost_count += lost_packets;
3262-
self.lost_bytes += lost_bytes as u64;
3263-
}
3264-
3265-
// Now that we processed all the frames, if there is a path that has no
3266-
// Destination CID, try to allocate one.
3267-
for (_, p) in self
3268-
.paths
3269-
.iter_mut()
3270-
.filter(|(_, p)| p.active_dcid_seq.is_none())
3271-
{
3272-
if self.ids.zero_length_dcid() {
3273-
p.active_dcid_seq = Some(0);
3274-
continue;
3275-
}
3276-
3277-
let dcid_seq = match self.ids.lowest_available_dcid_seq(p.path_id()) {
3278-
Some(seq) => seq,
3279-
None => break,
3280-
};
3281-
3282-
update_dcid(
3283-
&mut self.ids,
3284-
(p.local_addr(), p.peer_addr()),
3285-
p,
3286-
Some(dcid_seq),
3287-
)?;
3288-
}
3289-
32903251
let pkt_num_space =
32913252
self.pkt_num_spaces.spaces.get_mut(epoch, space_id)?;
32923253

@@ -3327,9 +3288,6 @@ impl Connection {
33273288
self.idle_timer = Some(now + idle_timeout);
33283289
}
33293290

3330-
// Update send capacity.
3331-
self.update_tx_cap();
3332-
33333291
self.recv_count += 1;
33343292
self.paths.get_mut(recv_pid)?.recv_count += 1;
33353293

@@ -3349,6 +3307,53 @@ impl Connection {
33493307

33503308
self.ack_eliciting_sent = false;
33513309

3310+
// Because we may close the very current path, this should be done last.
3311+
for path_id in self.path_id_to_abandon.drain(..) {
3312+
debug!("{} abandonning path id {path_id}", self.trace_id);
3313+
let (lost_packets, lost_bytes) = close_path(
3314+
&mut self.ids,
3315+
&mut self.pkt_num_spaces,
3316+
&mut self.paths,
3317+
path_id,
3318+
now,
3319+
&self.trace_id,
3320+
)?;
3321+
debug!(
3322+
"{} close path with path_id {path_id} succeeded",
3323+
self.trace_id
3324+
);
3325+
self.lost_count += lost_packets;
3326+
self.lost_bytes += lost_bytes as u64;
3327+
}
3328+
3329+
// Now that we processed all the frames, if there is a path that has no
3330+
// Destination CID, try to allocate one.
3331+
for (_, p) in self
3332+
.paths
3333+
.iter_mut()
3334+
.filter(|(_, p)| p.active_dcid_seq.is_none())
3335+
{
3336+
if self.ids.zero_length_dcid() {
3337+
p.active_dcid_seq = Some(0);
3338+
continue;
3339+
}
3340+
3341+
let dcid_seq = match self.ids.lowest_available_dcid_seq(p.path_id()) {
3342+
Some(seq) => seq,
3343+
None => break,
3344+
};
3345+
3346+
update_dcid(
3347+
&mut self.ids,
3348+
(p.local_addr(), p.peer_addr()),
3349+
p,
3350+
Some(dcid_seq),
3351+
)?;
3352+
}
3353+
3354+
// Update send capacity.
3355+
self.update_tx_cap();
3356+
33523357
Ok(read)
33533358
}
33543359

0 commit comments

Comments
 (0)