fix: Dont create new megolm session if one is creating
This commit is contained in:
parent
2841d1636c
commit
fbd7393fce
|
|
@ -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