@@ -24,9 +24,7 @@ use crate::{
2424 config:: { ServerConfig , TransportConfig } ,
2525 congestion:: Controller ,
2626 crypto:: { self , KeyPair , Keys , PacketKey } ,
27- frame:: {
28- self , Close , Datagram , FrameStruct , NewToken , ObservedAddr , PathAbandon , PathAvailable ,
29- } ,
27+ frame:: { self , Close , Datagram , FrameStruct , NewToken , ObservedAddr , PathAvailable } ,
3028 packet:: {
3129 FixedLengthConnectionIdParser , Header , InitialHeader , InitialPacket , LongType , Packet ,
3230 PacketNumber , PartialDecode , SpaceId ,
@@ -581,14 +579,11 @@ impl Connection {
581579 // This allows us to safely consume the path_id due to the failed attempt, otherwise
582580 // we would need to keep track of holes in the range and revert the
583581 // max_path_id_in_use
584-
585- return Some ( (
586- None ,
587- vec ! [ Frame :: PathAbandon ( PathAbandon {
588- path_id,
589- error_code: TransportErrorCode :: NO_CID_AVAILABLE ,
590- } ) ] ,
591- ) ) ;
582+ self . spaces [ SpaceId :: Data ]
583+ . pending
584+ . path_abandon
585+ . push ( ( path_id, TransportErrorCode :: NO_CID_AVAILABLE ) ) ;
586+ return None ;
592587 } ;
593588
594589 let mut path = PathData :: new ( remote, self . allow_mtud , None , now, & self . config ) ;
@@ -4087,6 +4082,23 @@ impl Connection {
40874082 }
40884083 }
40894084
4085+ // PATH_ABANDON
4086+ while !path_exclusive_only
4087+ && space_id == SpaceId :: Data
4088+ && frame:: PathAbandon :: SIZE_BOUND <= buf. remaining_mut ( )
4089+ {
4090+ let Some ( ( path_id, error_code) ) = space. pending . path_abandon . pop ( ) else {
4091+ break ;
4092+ } ;
4093+ frame:: PathAbandon {
4094+ path_id,
4095+ error_code,
4096+ }
4097+ . encode ( buf) ;
4098+ // TODO(flub): frame stats?
4099+ }
4100+
4101+ // RESET_STREAM, STOP_SENDING, MAX_DATA, MAX_STREAM_DATA, MAX_STREAMS
40904102 if space_id == SpaceId :: Data {
40914103 self . streams . write_control_frames (
40924104 buf,
0 commit comments