crypto: Recreate group sessions if they are expired.

master
Damir Jelić 2020-04-10 09:58:13 +02:00
parent 0215e89ff8
commit c5f7af9118
1 changed files with 12 additions and 0 deletions

View File

@ -935,6 +935,18 @@ impl OlmMachine {
}
let megolm_session = self.outbound_group_session.get(room_id).unwrap();
let megolm_session = if megolm_session.expired() {
self.create_outbound_group_session(room_id).await?;
self.outbound_group_session.get(room_id).unwrap()
} else {
megolm_session
};
if megolm_session.shared() {
panic!("Session is already shared");
}
let session_id = megolm_session.session_id().to_owned();
megolm_session.mark_as_shared();