File tree Expand file tree Collapse file tree 3 files changed +14
-13
lines changed Expand file tree Collapse file tree 3 files changed +14
-13
lines changed Original file line number Diff line number Diff line change @@ -570,6 +570,16 @@ impl Connection {
570
570
}
571
571
}
572
572
573
+ /// Returns the remote path status
574
+ // TODO(flub): Probably should also be some kind of path event? Not even sure if I like
575
+ // this as an API, but for now it allows me to write a test easily.
576
+ // TODO(flub): Technically this should be a Result<Option<PathSTatus>>?
577
+ pub fn remote_path_status ( & self , path_id : PathId ) -> Option < PathStatus > {
578
+ self . paths
579
+ . get ( & path_id)
580
+ . and_then ( |path| path. data . status . remote_status )
581
+ }
582
+
573
583
/// Gets the [`PathData`] for a known [`PathId`].
574
584
///
575
585
/// Will panic if the path_id does not reference any known path.
Original file line number Diff line number Diff line change @@ -487,7 +487,7 @@ pub(super) struct PathStatusState {
487
487
/// This is the number of the *next* path status frame to be sent.
488
488
pub ( super ) local_seq : VarInt ,
489
489
/// The status set by the remote
490
- pub ( super ) remote_status : PathStatus ,
490
+ pub ( super ) remote_status : Option < PathStatus > ,
491
491
/// Remote sequence number, for both PATH_AVAIALABLE and PATH_BACKUP
492
492
pub ( super ) remote_seq : Option < VarInt > ,
493
493
}
@@ -500,8 +500,8 @@ impl PathStatusState {
500
500
return ;
501
501
}
502
502
self . remote_seq = Some ( seq) ;
503
- let prev = std:: mem:: replace ( & mut self . remote_status , status) ;
504
- if prev != status {
503
+ let prev = std:: mem:: replace ( & mut self . remote_status , Some ( status) ) ;
504
+ if prev != Some ( status) {
505
505
debug ! ( ?status, ?seq, "remote changed path status" ) ;
506
506
}
507
507
}
Original file line number Diff line number Diff line change @@ -96,7 +96,6 @@ fn path_status() {
96
96
let _guard = subscribe ( ) ;
97
97
let ( mut pair, client_ch, server_ch) = multipath_pair ( ) ;
98
98
99
- info ! ( "client sets PATH_BACKUP" ) ;
100
99
let client_conn = pair. client_conn_mut ( client_ch) ;
101
100
let prev_status = client_conn
102
101
. set_path_status ( PathId :: ZERO , PathStatus :: Backup )
@@ -108,15 +107,7 @@ fn path_status() {
108
107
109
108
let server_conn = pair. server_conn_mut ( server_ch) ;
110
109
assert_eq ! (
111
- server_conn. path_status ( PathId :: ZERO ) . unwrap( ) ,
110
+ server_conn. remote_path_status ( PathId :: ZERO ) . unwrap( ) ,
112
111
PathStatus :: Backup
113
112
) ;
114
-
115
- info ! ( "server sets PATH_AVAILABLE" ) ;
116
- server_conn
117
- . set_path_status ( PathId :: ZERO , PathStatus :: Available )
118
- . unwrap ( ) ;
119
-
120
- // Send the frame to the client
121
- pair. drive ( )
122
113
}
You can’t perform that action at this time.
0 commit comments