crytpo: Change the share_group_session method to always create a new session.
This commit is contained in:
parent
1504b3a02a
commit
0a2b66de9a
2 changed files with 3 additions and 13 deletions
|
@ -442,7 +442,7 @@ impl Client {
|
|||
Some(o) => {
|
||||
let room = room.lock().await;
|
||||
let members = room.members.keys();
|
||||
Ok(o.share_megolm_session(room_id, members).await?)
|
||||
Ok(o.share_group_session(room_id, members).await?)
|
||||
}
|
||||
None => panic!("Olm machine wasn't started"),
|
||||
}
|
||||
|
|
|
@ -920,7 +920,7 @@ impl OlmMachine {
|
|||
}
|
||||
|
||||
// TODO accept an algorithm here
|
||||
pub(crate) async fn share_megolm_session<'a, I>(
|
||||
pub(crate) async fn share_group_session<'a, I>(
|
||||
&mut self,
|
||||
room_id: &RoomId,
|
||||
users: I,
|
||||
|
@ -928,19 +928,9 @@ impl OlmMachine {
|
|||
where
|
||||
I: IntoIterator<Item = &'a UserId>,
|
||||
{
|
||||
if !self.outbound_group_session.contains_key(room_id) {
|
||||
self.create_outbound_group_session(room_id).await?
|
||||
}
|
||||
|
||||
self.create_outbound_group_session(room_id).await?;
|
||||
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");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue