This commit is contained in:
Jędrzej Stuczyński
2025-05-19 11:58:53 +01:00
parent 4bff5631b6
commit 729f455e80
13 changed files with 165 additions and 12 deletions
@@ -198,7 +198,6 @@ impl KeyRotationController {
{
// mutex poisoning - we have to exit
self.shutdown_token.cancel();
return;
}
// no need to send the information explicitly to nym-apis, as they're scheduled to refresh
@@ -217,7 +216,6 @@ impl KeyRotationController {
{
// mutex poisoning - we have to exit
self.shutdown_token.cancel();
return;
}
}
@@ -229,7 +227,6 @@ impl KeyRotationController {
if self.replay_protection_manager.purge_secondary().is_err() {
// mutex poisoning - we have to exit
self.shutdown_token.cancel();
return;
}
}
@@ -238,18 +238,21 @@ impl ReplayProtectionBloomfilters {
}
}
// map from particular rotation id to vector of results, based on the order of requests received
type BatchCheckResult = HashMap<u32, Vec<bool>>;
impl ReplayProtectionBloomfilters {
pub(crate) fn batch_try_check_and_set(
&self,
reply_tags: &HashMap<u32, Vec<&[u8; REPLAY_TAG_SIZE]>>,
) -> Option<Result<HashMap<u32, Vec<bool>>, PoisonError<()>>> {
) -> Option<Result<BatchCheckResult, PoisonError<()>>> {
let mut guard = match self.inner.try_lock() {
Ok(guard) => guard,
Err(TryLockError::Poisoned(_)) => return Some(Err(PoisonError::new(()))),
Err(TryLockError::WouldBlock) => return None,
};
Some(Ok(guard.batch_check_and_set(&reply_tags)))
Some(Ok(guard.batch_check_and_set(reply_tags)))
}
pub(crate) fn batch_check_and_set(
@@ -260,7 +263,7 @@ impl ReplayProtectionBloomfilters {
return Err(PoisonError::new(()));
};
Ok(guard.batch_check_and_set(&reply_tags))
Ok(guard.batch_check_and_set(reply_tags))
}
}