@@ -1120,6 +1120,7 @@ impl Connection {
11201120 QlogSentPacket :: default ( ) . frame ( & Frame :: PathChallenge ( challenge) ) ;
11211121 self . stats . frame_tx . path_challenge += 1 ;
11221122
1123+ // TODO(@divma): padding
11231124 // Remember the token sent to this remote
11241125 probing. finish ( token) ;
11251126 return Some ( Transmit {
@@ -1334,15 +1335,29 @@ impl Connection {
13341335
13351336 // Send an off-path PATH_RESPONSE. Prioritized over on-path data to ensure that
13361337 // path validation can occur while the link is saturated.
1337- if space_id == SpaceId :: Data && builder. buf . num_datagrams ( ) == 1 {
1338+ if space_id == SpaceId :: Data && builder. buf . is_empty ( ) {
13381339 let path = self . path_data_mut ( path_id) ;
13391340 if let Some ( ( token, remote) ) = path. path_responses . pop_off_path ( path. remote ) {
1340- // TODO(@divma): Here we would need to create a new builder to set a different
1341- // CID. Why do we check `num_datagrams` being 1??
1342-
1343- // TODO(flub): We need to use the right CID! We shouldn't use the same
1344- // CID as the current active one for the path. Though see also
1345- // https://github.com/quinn-rs/quinn/issues/2184
1341+ let mut builder = if let Some ( fresh_cid) = self
1342+ . rem_cids
1343+ . get_mut ( & path_id)
1344+ . and_then ( CidQueue :: next_reserved)
1345+ {
1346+ PacketBuilder :: new (
1347+ now,
1348+ space_id,
1349+ path_id,
1350+ fresh_cid,
1351+ & mut transmit,
1352+ can_send. other ,
1353+ self ,
1354+ & mut qlog,
1355+ ) ?
1356+ } else {
1357+ // TODO(@divma): keep the old logic. We would need to push the challenge
1358+ // back, but we have lost the packet number.
1359+ builder
1360+ } ;
13461361 let response = frame:: PathResponse ( token) ;
13471362 trace ! ( %response, "(off-path)" ) ;
13481363 builder. frame_space_mut ( ) . write ( response) ;
0 commit comments