From 2f775faab66f35563cacaa989170e101ccbbed80 Mon Sep 17 00:00:00 2001 From: Divma <26765164+divagant-martian@users.noreply.github.com> Date: Tue, 8 Jul 2025 23:30:03 -0500 Subject: [PATCH] simplify getting the next path id (#113) --- quinn-proto/src/connection/mod.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/quinn-proto/src/connection/mod.rs b/quinn-proto/src/connection/mod.rs index 5f4890953..54e47b237 100644 --- a/quinn-proto/src/connection/mod.rs +++ b/quinn-proto/src/connection/mod.rs @@ -534,11 +534,10 @@ impl Connection { return Err(PathError::ServerSideNotAllowed); } - let open_paths: FxHashSet = self.paths.keys().copied().collect(); - let used_paths = open_paths.union(&self.abandoned_paths); - let path_id = used_paths - .max() - .copied() + let max_abandoned = self.abandoned_paths.iter().max().copied(); + let max_used = self.paths.keys().last().copied(); + let path_id = max_abandoned + .max(max_used) .unwrap_or(PathId::ZERO) .saturating_add(1u8);