From 12619ab8b359133d5a4252ffd21fcddf0ac41141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Thu, 27 May 2021 16:15:51 +0200 Subject: [PATCH] crypto: Log a warning if we get a start event without being ready --- matrix_sdk_crypto/src/verification/requests.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/matrix_sdk_crypto/src/verification/requests.rs b/matrix_sdk_crypto/src/verification/requests.rs index 645455f8..49c46431 100644 --- a/matrix_sdk_crypto/src/verification/requests.rs +++ b/matrix_sdk_crypto/src/verification/requests.rs @@ -387,11 +387,16 @@ impl VerificationRequest { sender: &UserId, content: impl Into>, ) -> Result<(), CryptoStoreError> { - match &*self.inner.lock().unwrap() { - InnerRequest::Created(_) => {} - InnerRequest::Requested(_) => {} - InnerRequest::Ready(s) => s.receive_start(sender, content).await?, - InnerRequest::Passive(_) => {} + let content = content.into(); + + if let InnerRequest::Ready(s) = &*self.inner.lock().unwrap() { + s.receive_start(sender, content).await?; + } else { + warn!( + sender = sender.as_str(), + device_id = content.from_device().as_str(), + "Received a key verification start event but we're not yet in the ready state" + ) } Ok(())