crypto: Add a pending requests method for the outbound group session
parent
aadbc14dc6
commit
43a74524c5
|
@ -374,6 +374,15 @@ impl OutboundGroupSession {
|
||||||
.or_insert_with(DashSet::new)
|
.or_insert_with(DashSet::new)
|
||||||
.insert(device_id.to_owned());
|
.insert(device_id.to_owned());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get the list of requests that need to be sent out for this session to be
|
||||||
|
/// marked as shared.
|
||||||
|
pub(crate) fn pending_requests(&self) -> Vec<Arc<ToDeviceRequest>> {
|
||||||
|
self.to_share_with_set
|
||||||
|
.iter()
|
||||||
|
.map(|i| i.value().clone())
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(tarpaulin_include))]
|
#[cfg(not(tarpaulin_include))]
|
||||||
|
|
|
@ -244,7 +244,6 @@ impl GroupSessionManager {
|
||||||
.collect::<Vec<(&UserId, &DeviceId)>>()
|
.collect::<Vec<(&UserId, &DeviceId)>>()
|
||||||
);
|
);
|
||||||
|
|
||||||
let mut requests = Vec::new();
|
|
||||||
let key_content = outbound.as_json().await;
|
let key_content = outbound.as_json().await;
|
||||||
|
|
||||||
for device_map_chunk in devices.chunks(Self::MAX_TO_DEVICE_MESSAGES) {
|
for device_map_chunk in devices.chunks(Self::MAX_TO_DEVICE_MESSAGES) {
|
||||||
|
@ -283,12 +282,13 @@ impl GroupSessionManager {
|
||||||
messages,
|
messages,
|
||||||
});
|
});
|
||||||
|
|
||||||
outbound.add_request(id, request.clone());
|
outbound.add_request(id, request);
|
||||||
self.outbound_sessions_being_shared
|
self.outbound_sessions_being_shared
|
||||||
.insert(id, outbound.clone());
|
.insert(id, outbound.clone());
|
||||||
requests.push(request);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let requests = outbound.pending_requests();
|
||||||
|
|
||||||
if requests.is_empty() {
|
if requests.is_empty() {
|
||||||
debug!(
|
debug!(
|
||||||
"Session {} for room {} doesn't need to be shared with anyone, marking as shared",
|
"Session {} for room {} doesn't need to be shared with anyone, marking as shared",
|
||||||
|
|
Loading…
Reference in New Issue