crypto: Borrow InboundGroupSession for async fn's that don't need to own

Reduces the size of the returned futures.
This commit is contained in:
Jonas Platte
2023-05-05 12:17:09 +02:00
committed by Jonas Platte
parent 70c2cf6fe4
commit 794ab8bc9f

View File

@@ -340,7 +340,7 @@ impl GossipMachine {
&self,
event: &RoomKeyRequestEvent,
device: Device,
session: InboundGroupSession,
session: &InboundGroupSession,
message_index: Option<u32>,
) -> OlmResult<Option<Session>> {
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<Option<Session>> {
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,