mirror of
https://github.com/telemt/telemt.git
synced 2026-09-22 10:38:26 +03:00
Restart-gated Decoy Fast-Track
Co-Authored-By: brekotis <93345790+brekotis@users.noreply.github.com>
This commit is contained in:
@@ -24,12 +24,17 @@ pub(super) fn match_profile(
|
||||
vhost: &WebRuntimeVhost,
|
||||
candidate: &[u8; 32],
|
||||
) -> Option<Arc<WebRuntimeProfile>> {
|
||||
debug_assert_eq!(vhost.capabilities.len(), vhost.profiles.len());
|
||||
// Runtime construction owns alignment; any future constructor drift must fail closed.
|
||||
if vhost.capabilities.len() != vhost.profiles.len() {
|
||||
return None;
|
||||
}
|
||||
let scan = scan_capabilities(&vhost.capabilities, candidate);
|
||||
if bool::from(scan.matched) {
|
||||
usize::try_from(scan.matched_index)
|
||||
.ok()
|
||||
.and_then(|index| vhost.profiles.get(index))
|
||||
// Revalidate the selected identity after the index-only complete scan.
|
||||
.filter(|profile| bool::from(profile.capability.ct_eq(candidate)))
|
||||
.map(Arc::clone)
|
||||
} else {
|
||||
None
|
||||
|
||||
Reference in New Issue
Block a user