From dc66994d663a543984d1b6d32d8cc299def1a422 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Mon, 23 Feb 2026 14:53:13 +0000 Subject: [PATCH] sdk: make `should_accept_bundle` async We're going to need to call async methods here, so prepare for it by making it async --- crates/matrix-sdk/src/encryption/tasks.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/matrix-sdk/src/encryption/tasks.rs b/crates/matrix-sdk/src/encryption/tasks.rs index 96740fcff..95ad57d8a 100644 --- a/crates/matrix-sdk/src/encryption/tasks.rs +++ b/crates/matrix-sdk/src/encryption/tasks.rs @@ -471,7 +471,7 @@ impl BundleReceiverTask { #[instrument(skip(room), fields(room_id = %room.room_id()))] async fn handle_bundle(room: &Room, bundle_info: &RoomKeyBundleInfo) { - if Self::should_accept_bundle(room, bundle_info) { + if Self::should_accept_bundle(room, bundle_info).await { info!("Accepting a late key bundle."); if let Err(e) = @@ -484,7 +484,7 @@ impl BundleReceiverTask { } } - fn should_accept_bundle(room: &Room, bundle_info: &RoomKeyBundleInfo) -> bool { + async fn should_accept_bundle(room: &Room, bundle_info: &RoomKeyBundleInfo) -> bool { // We accept historic room key bundles up to one day after we have accepted an // invite. const DAY: Duration = Duration::from_secs(24 * 60 * 60); @@ -636,7 +636,7 @@ mod test { }; assert!( - !BundleReceiverTask::should_accept_bundle(&room, &bundle_info), + !BundleReceiverTask::should_accept_bundle(&room, &bundle_info).await, "We should not accept a bundle if we did not join the room from this Client" ); @@ -644,7 +644,7 @@ mod test { client.get_room(invited_rom_id).expect("We should have access to our invited room now"); assert!( - !BundleReceiverTask::should_accept_bundle(&invited_room, &bundle_info), + !BundleReceiverTask::should_accept_bundle(&invited_room, &bundle_info).await, "We should not accept a bundle if we didn't join the room." ); @@ -661,7 +661,7 @@ mod test { assert_eq!(details.inviter, bob_user_id, "We should have recorded that Bob has invited us"); assert!( - BundleReceiverTask::should_accept_bundle(&room, &bundle_info), + BundleReceiverTask::should_accept_bundle(&room, &bundle_info).await, "We should accept a bundle if we just joined the room and did so from this very Client object" ); }