From 8a0b779d20f54b47dcb376aecfaef75f2f4471d1 Mon Sep 17 00:00:00 2001 From: Floris Bruynooghe Date: Mon, 2 Mar 2026 11:38:18 +0100 Subject: [PATCH] more wip --- quinn-proto/src/connection/mod.rs | 39 +++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/quinn-proto/src/connection/mod.rs b/quinn-proto/src/connection/mod.rs index 5e1132080..baccc131a 100644 --- a/quinn-proto/src/connection/mod.rs +++ b/quinn-proto/src/connection/mod.rs @@ -6900,20 +6900,35 @@ fn should_send_data(all: &BTreeMap, current: PathId) // - not abandoned // - status-available unless there is no such path let this = all.get(¤t).unwrap(); - if !this.has_cids || !this.validated || this.abandoned { + if !this.has_cids || this.abandoned { return false; } - if this.status == PathStatus::Available { - return true; - } - !data_space_available(all) -} - -/// Whether there is any path that can send SpaceKind::Data with PathStatus::Available -fn data_space_available(all: &BTreeMap) -> bool { - all.values() - .filter(|info| info.has_cids && info.validated && !info.abandoned) - .any(|info| info.status == PathStatus::Available) + let have_better_path = if !this.validated { + all.values().any(|info| { + let PathSchedulingInfo { + has_cids, + validated, + abandoned, + status: _, + } = *info; + has_cids && !abandoned && validated + }) + } else { + // path is validated + match this.status { + PathStatus::Available => return true, + PathStatus::Backup => all.values().any(|info| { + let PathSchedulingInfo { + has_cids, + validated, + abandoned, + status, + } = *info; + has_cids && !abandoned && validated && status == PathStatus::Available + }), + } + }; + !have_better_path } #[derive(Debug, Copy, Clone, PartialEq, Eq)]