Merge branch 'krille/create-megolm-session-handling' into 'main'
fix: Dont create new megolm session if one is creating Closes #129 See merge request famedly/famedlysdk!569
This commit is contained in:
commit
59d5849acc
|
|
@ -384,7 +384,21 @@ class KeyManager {
|
||||||
sess.sentMessages);
|
sess.sentMessages);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final Map<String, Future<OutboundGroupSession>>
|
||||||
|
_pendingNewOutboundGroupSessions = {};
|
||||||
|
|
||||||
Future<OutboundGroupSession> createOutboundGroupSession(String roomId) async {
|
Future<OutboundGroupSession> createOutboundGroupSession(String roomId) async {
|
||||||
|
if (_pendingNewOutboundGroupSessions.containsKey(roomId)) {
|
||||||
|
return _pendingNewOutboundGroupSessions[roomId];
|
||||||
|
}
|
||||||
|
_pendingNewOutboundGroupSessions[roomId] =
|
||||||
|
_createOutboundGroupSession(roomId);
|
||||||
|
await _pendingNewOutboundGroupSessions[roomId];
|
||||||
|
return _pendingNewOutboundGroupSessions.remove(roomId);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<OutboundGroupSession> _createOutboundGroupSession(
|
||||||
|
String roomId) async {
|
||||||
await clearOrUseOutboundGroupSession(roomId, wipe: true);
|
await clearOrUseOutboundGroupSession(roomId, wipe: true);
|
||||||
final room = client.getRoomById(roomId);
|
final room = client.getRoomById(roomId);
|
||||||
if (room == null) {
|
if (room == null) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue