@@ -11,7 +11,7 @@ use super::{
1111 spaces:: { PacketNumberSpace , SentPacket } ,
1212} ;
1313use crate :: {
14- ConnectionId , Duration , Instant , TIMER_GRANULARITY , TransportConfig , VarInt , coding,
14+ ConnectionId , Duration , FourTuple , Instant , TIMER_GRANULARITY , TransportConfig , VarInt , coding,
1515 congestion, frame:: ObservedAddr , packet:: SpaceId ,
1616} ;
1717
@@ -124,14 +124,14 @@ impl PathState {
124124pub ( super ) struct SentChallengeInfo {
125125 /// When was the challenge sent on the wire.
126126 pub ( super ) sent_instant : Instant ,
127- /// The remote to which this path challenge was sent.
128- pub ( super ) remote : SocketAddr ,
127+ /// The 4-tuple on which this path challenge was sent.
128+ pub ( super ) addresses : FourTuple ,
129129}
130130
131131/// Description of a particular network path
132132#[ derive( Debug ) ]
133133pub ( super ) struct PathData {
134- pub ( super ) remote : SocketAddr ,
134+ pub ( super ) addresses : FourTuple ,
135135 pub ( super ) rtt : RttEstimator ,
136136 /// Whether we're enabling ECN on outgoing packets
137137 pub ( super ) sending_ecn : bool ,
@@ -223,7 +223,7 @@ pub(super) struct PathData {
223223
224224impl PathData {
225225 pub ( super ) fn new (
226- remote : SocketAddr ,
226+ addresses : FourTuple ,
227227 allow_mtud : bool ,
228228 peer_max_udp_payload_size : Option < u16 > ,
229229 generation : u64 ,
@@ -235,7 +235,7 @@ impl PathData {
235235 . clone ( )
236236 . build ( now, config. get_initial_mtu ( ) ) ;
237237 Self {
238- remote ,
238+ addresses ,
239239 rtt : RttEstimator :: new ( config. initial_rtt ) ,
240240 sending_ecn : true ,
241241 pacing : Pacer :: new (
@@ -287,15 +287,15 @@ impl PathData {
287287 ///
288288 /// This should only be called when migrating paths.
289289 pub ( super ) fn from_previous (
290- remote : SocketAddr ,
290+ addresses : FourTuple ,
291291 prev : & Self ,
292292 generation : u64 ,
293293 now : Instant ,
294294 ) -> Self {
295295 let congestion = prev. congestion . clone_box ( ) ;
296296 let smoothed_rtt = prev. rtt . get ( ) ;
297297 Self {
298- remote ,
298+ addresses ,
299299 rtt : prev. rtt ,
300300 pacing : Pacer :: new ( smoothed_rtt, congestion. window ( ) , prev. current_mtu ( ) , now) ,
301301 sending_ecn : true ,
@@ -366,7 +366,7 @@ impl PathData {
366366 self . total_sent = self . total_sent . saturating_add ( inc) ;
367367 if !self . validated {
368368 trace ! (
369- remote = %self . remote ,
369+ addresses = %self . addresses ,
370370 anti_amplification_budget = %( self . total_recvd * 3 ) . saturating_sub( self . total_sent) ,
371371 "anti amplification budget decreased"
372372 ) ;
@@ -378,7 +378,7 @@ impl PathData {
378378 self . total_recvd = self . total_recvd . saturating_add ( inc) ;
379379 if !self . validated {
380380 trace ! (
381- remote = %self . remote ,
381+ addresses = %self . addresses ,
382382 anti_amplification_budget = %( self . total_recvd * 3 ) . saturating_sub( self . total_sent) ,
383383 "anti amplification budget increased"
384384 ) ;
@@ -638,15 +638,18 @@ pub(crate) struct PathResponses {
638638}
639639
640640impl PathResponses {
641- pub ( crate ) fn push ( & mut self , packet : u64 , token : u64 , remote : SocketAddr ) {
641+ pub ( crate ) fn push ( & mut self , packet : u64 , token : u64 , addresses : FourTuple ) {
642642 /// Arbitrary permissive limit to prevent abuse
643643 const MAX_PATH_RESPONSES : usize = 16 ;
644644 let response = PathResponse {
645645 packet,
646646 token,
647- remote ,
647+ addresses ,
648648 } ;
649- let existing = self . pending . iter_mut ( ) . find ( |x| x. remote == remote) ;
649+ let existing = self
650+ . pending
651+ . iter_mut ( )
652+ . find ( |x| x. addresses . remote == addresses. remote ) ;
650653 if let Some ( existing) = existing {
651654 // Update a queued response
652655 if existing. packet <= packet {
@@ -663,20 +666,20 @@ impl PathResponses {
663666 }
664667 }
665668
666- pub ( crate ) fn pop_off_path ( & mut self , remote : SocketAddr ) -> Option < ( u64 , SocketAddr ) > {
669+ pub ( crate ) fn pop_off_path ( & mut self , addresses : FourTuple ) -> Option < ( u64 , FourTuple ) > {
667670 let response = * self . pending . last ( ) ?;
668- if response. remote == remote {
671+ if response. addresses . is_same_path ( & addresses ) {
669672 // We don't bother searching further because we expect that the on-path response will
670673 // get drained in the immediate future by a call to `pop_on_path`
671674 return None ;
672675 }
673676 self . pending . pop ( ) ;
674- Some ( ( response. token , response. remote ) )
677+ Some ( ( response. token , response. addresses ) )
675678 }
676679
677- pub ( crate ) fn pop_on_path ( & mut self , remote : SocketAddr ) -> Option < u64 > {
680+ pub ( crate ) fn pop_on_path ( & mut self , addresses : FourTuple ) -> Option < u64 > {
678681 let response = * self . pending . last ( ) ?;
679- if response. remote != remote {
682+ if ! response. addresses . is_same_path ( & addresses ) {
680683 // We don't bother searching further because we expect that the off-path response will
681684 // get drained in the immediate future by a call to `pop_off_path`
682685 return None ;
@@ -696,8 +699,8 @@ struct PathResponse {
696699 packet : u64 ,
697700 /// The token of the PATH_CHALLENGE
698701 token : u64 ,
699- /// The address the corresponding PATH_CHALLENGE was received from
700- remote : SocketAddr ,
702+ /// The path the corresponding PATH_CHALLENGE was received from
703+ addresses : FourTuple ,
701704}
702705
703706/// Summary statistics of packets that have been sent on a particular path, but which have not yet
0 commit comments