crypto: Remove verification objects that are done or canceled.

master
Damir Jelić 2020-08-03 16:18:35 +02:00
parent 01ba94c670
commit 9f0fbcccf6
2 changed files with 7 additions and 0 deletions

View File

@ -1094,6 +1094,8 @@ impl OlmMachine {
/// * `response` - The sync latest sync response.
#[instrument(skip(response))]
pub async fn receive_sync_response(&mut self, response: &mut SyncResponse) {
self.verification_machine.garbage_collect();
let one_time_key_count = response
.device_one_time_keys_count
.get(&keys::KeyAlgorithm::SignedCurve25519);

View File

@ -81,6 +81,11 @@ impl VerificationMachine {
.collect()
}
pub fn garbage_collect(&self) {
self.verifications
.retain(|_, s| !(s.is_canceled() || s.is_done()));
}
pub async fn receive_event(
&self,
event: &mut AnyToDeviceEvent,