@@ -3248,45 +3248,6 @@ impl Connection {
3248
3248
}
3249
3249
}
3250
3250
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
-
3290
3251
let pkt_num_space =
3291
3252
self.pkt_num_spaces.spaces.get_mut(epoch, space_id)?;
3292
3253
@@ -3327,9 +3288,6 @@ impl Connection {
3327
3288
self.idle_timer = Some(now + idle_timeout);
3328
3289
}
3329
3290
3330
- // Update send capacity.
3331
- self.update_tx_cap();
3332
-
3333
3291
self.recv_count += 1;
3334
3292
self.paths.get_mut(recv_pid)?.recv_count += 1;
3335
3293
@@ -3349,6 +3307,53 @@ impl Connection {
3349
3307
3350
3308
self.ack_eliciting_sent = false;
3351
3309
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
+
3352
3357
Ok(read)
3353
3358
}
3354
3359
0 commit comments