crypto: Add a pending requests method for the outbound group session
This commit is contained in:
parent
aadbc14dc6
commit
43a74524c5
2 changed files with 12 additions and 3 deletions
|
@ -374,6 +374,15 @@ impl OutboundGroupSession {
|
|||
.or_insert_with(DashSet::new)
|
||||
.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))]
|
||||
|
|
|
@ -244,7 +244,6 @@ impl GroupSessionManager {
|
|||
.collect::<Vec<(&UserId, &DeviceId)>>()
|
||||
);
|
||||
|
||||
let mut requests = Vec::new();
|
||||
let key_content = outbound.as_json().await;
|
||||
|
||||
for device_map_chunk in devices.chunks(Self::MAX_TO_DEVICE_MESSAGES) {
|
||||
|
@ -283,12 +282,13 @@ impl GroupSessionManager {
|
|||
messages,
|
||||
});
|
||||
|
||||
outbound.add_request(id, request.clone());
|
||||
outbound.add_request(id, request);
|
||||
self.outbound_sessions_being_shared
|
||||
.insert(id, outbound.clone());
|
||||
requests.push(request);
|
||||
}
|
||||
|
||||
let requests = outbound.pending_requests();
|
||||
|
||||
if requests.is_empty() {
|
||||
debug!(
|
||||
"Session {} for room {} doesn't need to be shared with anyone, marking as shared",
|
||||
|
|
Loading…
Reference in a new issue