diff --git a/crypto/src/mls/conversation/buffer_messages.rs b/crypto/src/mls/conversation/buffer_messages.rs index c3fda74a81..de06eea887 100644 --- a/crypto/src/mls/conversation/buffer_messages.rs +++ b/crypto/src/mls/conversation/buffer_messages.rs @@ -4,6 +4,7 @@ //! Feel free to delete all of this when the issue is fixed on the DS side ! use crate::context::CentralContext; +use crate::obfuscate::Obfuscated; use crate::{ group_store::GroupStoreValue, prelude::{ @@ -73,7 +74,6 @@ impl MlsConversation { is_rejoin: bool, ) -> CryptoResult>> { // using the macro produces a clippy warning - info!("restore_pending_messages"); let result = async move { let keystore = backend.keystore(); let group_id = self.id().as_slice(); @@ -109,6 +109,8 @@ impl MlsConversation { // luckily for us that's the exact same order as the [ContentType] enum pending_messages.sort_by(|(a, _), (b, _)| a.cmp(b)); + info!(group_id = Obfuscated::from(&self.id); "Attempting to restore {} buffered messages", pending_messages.len()); + let mut decrypted_messages = Vec::with_capacity(pending_messages.len()); for (_, m) in pending_messages { let parent_conversation = match &self.parent_id { diff --git a/crypto/src/mls/conversation/decrypt.rs b/crypto/src/mls/conversation/decrypt.rs index 848fc68c10..c11a0c6c20 100644 --- a/crypto/src/mls/conversation/decrypt.rs +++ b/crypto/src/mls/conversation/decrypt.rs @@ -248,6 +248,7 @@ impl MlsConversation { .restore_pending_messages(client, backend, callbacks, parent_conv, false) .await? { + info!(group_id = Obfuscated::from(&self.id); "Clearing all buffered messages for conversation"); backend.key_store().remove::(self.id()).await?; Some(pm) } else { @@ -442,10 +443,13 @@ impl CentralContext { ) .await; - let decrypt_message = match decrypt_message { - Err(CryptoError::BufferedFutureMessage) => self.handle_future_message(id, message).await?, - _ => decrypt_message?, - }; + if let Err(CryptoError::BufferedFutureMessage { message_epoch }) = decrypt_message { + self.handle_future_message(id, message).await?; + info!(group_id = Obfuscated::from(id); "Buffered future message from epoch {message_epoch}"); + return decrypt_message; + } + + let decrypt_message = decrypt_message?; if !decrypt_message.is_active { self.wipe_conversation(id).await?;