crypto: Don't send out empty to-device reuqests when sharing sessions

An empty to-device request can happen if we're trying to re-share a
session with devices that are we're missing an olm session with so don't
send them out.
master
Damir Jelić 2021-01-21 14:04:31 +01:00
parent ae0d810fb0
commit 1483c22171
1 changed files with 6 additions and 3 deletions

View File

@ -345,12 +345,15 @@ impl GroupSessionManager {
.encrypt_session_for(key_content.clone(), device_map_chunk) .encrypt_session_for(key_content.clone(), device_map_chunk)
.await?; .await?;
if !request.messages.is_empty() {
outbound.add_request(id, request.into()); outbound.add_request(id, request.into());
changes.sessions.extend(used_sessions);
self.outbound_sessions_being_shared self.outbound_sessions_being_shared
.insert(id, outbound.clone()); .insert(id, outbound.clone());
} }
changes.sessions.extend(used_sessions);
}
let requests = outbound.pending_requests(); let requests = outbound.pending_requests();
if requests.is_empty() { if requests.is_empty() {