Skip to content

Commit eaafda7

Browse files
committed
do not deadlock due to all paths being in standby
1 parent 848d3eb commit eaafda7

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

quiche/src/lib.rs

+6
Original file line numberDiff line numberDiff line change
@@ -3634,6 +3634,12 @@ impl Connection {
36343634
let multipath_enabled = self.paths.multipath();
36353635
let paths = &mut self.paths;
36363636

3637+
// Avoid being deadlocked if all available paths are standby.
3638+
if paths.all_available_paths_standby() {
3639+
// Force the availability of this path.
3640+
paths.set_path_status(send_pid, PathStatus::Available)?;
3641+
}
3642+
36373643
let mut left = b.cap();
36383644

36393645
let path = paths.get_mut(send_pid)?;

quiche/src/path.rs

+5
Original file line numberDiff line numberDiff line change
@@ -1209,6 +1209,11 @@ impl PathMap {
12091209
self.path_status_to_advertise.pop_front();
12101210
}
12111211

1212+
/// Are all paths in standby state?
1213+
pub fn all_available_paths_standby(&self) -> bool {
1214+
!self.paths.iter().all(|p| p.1.active() && !p.1.is_standby())
1215+
}
1216+
12121217
/// Handles the reception of PATH_STANDBY/PATH_AVAILABLE.
12131218
pub fn on_path_status_received(
12141219
&mut self, path_id: PathId, seq_num: u64, available: bool,

0 commit comments

Comments
 (0)