crypto: Improve the log line when we share group sessions

master
Damir Jelić 2021-01-18 14:15:31 +01:00
parent 436530e874
commit 4eb504d000
1 changed files with 13 additions and 9 deletions

View File

@ -21,7 +21,7 @@ use dashmap::DashMap;
use matrix_sdk_common::{ use matrix_sdk_common::{
api::r0::to_device::DeviceIdOrAllDevices, api::r0::to_device::DeviceIdOrAllDevices,
events::{room::encrypted::EncryptedEventContent, AnyMessageEventContent, EventType}, events::{room::encrypted::EncryptedEventContent, AnyMessageEventContent, EventType},
identifiers::{DeviceId, DeviceIdBox, RoomId, UserId}, identifiers::{DeviceIdBox, RoomId, UserId},
uuid::Uuid, uuid::Uuid,
}; };
use tracing::{debug, info}; use tracing::{debug, info};
@ -236,14 +236,18 @@ impl GroupSessionManager {
.flatten() .flatten()
.collect(); .collect();
if !devices.is_empty() {
info!( info!(
"Sharing outbound session at index {} with {:?}", "Sharing outbound session at index {} with {:?}",
outbound.message_index().await, outbound.message_index().await,
devices devices.iter().fold(HashMap::new(), |mut acc, d| {
.iter() acc.entry(d.user_id())
.map(|d| (d.user_id(), d.device_id())) .or_insert_with(Vec::new)
.collect::<Vec<(&UserId, &DeviceId)>>() .push(d.device_id());
acc
})
); );
}
let key_content = outbound.as_json().await; let key_content = outbound.as_json().await;