Skip to content

Commit

Permalink
do not deadlock due to all paths being in standby
Browse files Browse the repository at this point in the history
  • Loading branch information
qdeconinck committed Mar 18, 2024
1 parent 848d3eb commit eaafda7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions quiche/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3634,6 +3634,12 @@ impl Connection {
let multipath_enabled = self.paths.multipath();
let paths = &mut self.paths;

// Avoid being deadlocked if all available paths are standby.
if paths.all_available_paths_standby() {
// Force the availability of this path.
paths.set_path_status(send_pid, PathStatus::Available)?;
}

let mut left = b.cap();

let path = paths.get_mut(send_pid)?;
Expand Down
5 changes: 5 additions & 0 deletions quiche/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1209,6 +1209,11 @@ impl PathMap {
self.path_status_to_advertise.pop_front();
}

/// Are all paths in standby state?
pub fn all_available_paths_standby(&self) -> bool {
!self.paths.iter().all(|p| p.1.active() && !p.1.is_standby())
}

/// Handles the reception of PATH_STANDBY/PATH_AVAILABLE.
pub fn on_path_status_received(
&mut self, path_id: PathId, seq_num: u64, available: bool,
Expand Down

0 comments on commit eaafda7

Please sign in to comment.