Skip to content

Commit

Permalink
fix: Megolm sessions become invalid after restarting client
Browse files Browse the repository at this point in the history
This bug seems to be in the
sdk for 5 years already without
anyone noticing. The method
loadInboundGroupSession
seems to return the wrong
variable when loading the
session from the key. While
the outboundgroupsession
loading method relies on
an inbound group session, it
silently marks the outbound
group session as invalid on
every restart and creates a
new one. This means we never
reuse megolm sessions after
restarting the client.

Fixing this will probably reduce
the amount of megolm sessions
used in a conversation by a lot
which could improve the
performance and make the
key backup more reliable.
  • Loading branch information
krille-chan committed Feb 3, 2025
1 parent 0960e35 commit 4c9b701
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/encryption/key_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,7 @@ class KeyManager {
dbSess.sessionId != sessionId) {
return null;
}
roomInboundGroupSessions[sessionId] = dbSess;
return sess;
return roomInboundGroupSessions[sessionId] = dbSess;
}

Map<String, Map<String, bool>> _getDeviceKeyIdMap(
Expand Down

0 comments on commit 4c9b701

Please sign in to comment.