From 7eeff64059fad6a368028820d538df0cc5131680 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Mon, 10 Aug 2020 14:29:38 +0200 Subject: [PATCH] crypto: Cancel timed out events on the state transitions. --- matrix_sdk_crypto/src/verification/sas/sas_state.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/matrix_sdk_crypto/src/verification/sas/sas_state.rs b/matrix_sdk_crypto/src/verification/sas/sas_state.rs index b3d7e099..ffba64ba 100644 --- a/matrix_sdk_crypto/src/verification/sas/sas_state.rs +++ b/matrix_sdk_crypto/src/verification/sas/sas_state.rs @@ -57,7 +57,7 @@ const STRINGS: &[ShortAuthenticationString] = &[ const MAX_AGE: Duration = Duration::from_secs(60 * 5); // The max time a SAS object will wait for a new event to arrive. -const MAX_EVENT_TIMEOUT: Duration = Duration::from_secs(60 * 1); +const MAX_EVENT_TIMEOUT: Duration = Duration::from_secs(60); /// Struct containing the protocols that were agreed to be used for the SAS /// flow. @@ -244,6 +244,8 @@ impl SasState { Err(CancelCode::UnknownTransaction) } else if sender != self.ids.other_device.user_id() { Err(CancelCode::UserMismatch) + } else if self.timed_out() { + Err(CancelCode::Timeout) } else { Ok(()) }