Skip to content

Commit

Permalink
refactor: don't return Err(Error::BufferedFutureMessage) from `hand…
Browse files Browse the repository at this point in the history
…le_future_message()`

This was meaningless because in the one and only caller this error would always be propagated.
So we can just keep it in that context and raise it from there directly.
No need for an extra round trip.

(cherry picked and adjusted from commit 5d7af36)
  • Loading branch information
SimonThormeyer committed Jan 27, 2025
1 parent 91846bb commit c014c51
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crypto/src/mls/conversation/buffer_messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{
group_store::GroupStoreValue,
prelude::{
decrypt::MlsBufferedConversationDecryptMessage, Client, ConversationId, CoreCryptoCallbacks, CryptoError,
CryptoResult, MlsConversation, MlsConversationDecryptMessage, MlsError,
CryptoResult, MlsConversation, MlsError,
},
};
use core_crypto_keystore::{
Expand All @@ -25,15 +25,15 @@ impl CentralContext {
&self,
id: &ConversationId,
message: impl AsRef<[u8]>,
) -> CryptoResult<MlsConversationDecryptMessage> {
) -> CryptoResult<()> {
let keystore = self.keystore().await?;

let pending_msg = MlsPendingMessage {
foreign_id: id.clone(),
message: message.as_ref().to_vec(),
};
keystore.save::<MlsPendingMessage>(pending_msg).await?;
Err(CryptoError::BufferedFutureMessage)
Ok(())
}

pub(crate) async fn restore_pending_messages(
Expand Down

0 comments on commit c014c51

Please sign in to comment.