From 794ab8bc9f90b27fda7fa38d73be58422da31982 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Fri, 5 May 2023 12:17:09 +0200 Subject: [PATCH] crypto: Borrow InboundGroupSession for async fn's that don't need to own Reduces the size of the returned futures. --- crates/matrix-sdk-crypto/src/gossiping/machine.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/matrix-sdk-crypto/src/gossiping/machine.rs b/crates/matrix-sdk-crypto/src/gossiping/machine.rs index a9959d36e..f2cc61cb0 100644 --- a/crates/matrix-sdk-crypto/src/gossiping/machine.rs +++ b/crates/matrix-sdk-crypto/src/gossiping/machine.rs @@ -340,7 +340,7 @@ impl GossipMachine { &self, event: &RoomKeyRequestEvent, device: Device, - session: InboundGroupSession, + session: &InboundGroupSession, message_index: Option, ) -> OlmResult> { info!( @@ -352,7 +352,7 @@ impl GossipMachine { "Serving a room key request", ); - match self.forward_room_key(&session, &device, message_index).await { + match self.forward_room_key(session, &device, message_index).await { Ok(s) => Ok(Some(s)), Err(OlmError::MissingSession) => { info!( @@ -386,7 +386,7 @@ impl GossipMachine { async fn answer_room_key_request( &self, event: &RoomKeyRequestEvent, - session: InboundGroupSession, + session: &InboundGroupSession, ) -> OlmResult> { use super::KeyForwardDecision; @@ -404,7 +404,7 @@ impl GossipMachine { return Ok(None); }; - match self.should_share_key(&device, &session).await { + match self.should_share_key(&device, session).await { Ok(message_index) => { self.try_to_forward_room_key(event, device, session, message_index).await } @@ -440,7 +440,7 @@ impl GossipMachine { let session = self.store.get_inbound_group_session(room_id, session_id).await?; if let Some(s) = session { - self.answer_room_key_request(event, s).await + self.answer_room_key_request(event, &s).await } else { debug!( user_id = ?event.sender,