mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
prevent multiple checks if a new room key is better
This commit is contained in:
parent
d08c41c13a
commit
5682e715e6
@ -6,9 +6,10 @@ export class BaseRoomKey {
|
|||||||
this._isBetter = null;
|
this._isBetter = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async createSessionInfo(olm, pickleKey, txn) {
|
async createSessionInfo(olm, pickleKey, txn) {
|
||||||
|
if (this._isBetter === false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const session = new olm.InboundGroupSession();
|
const session = new olm.InboundGroupSession();
|
||||||
try {
|
try {
|
||||||
this._loadSessionKey(session);
|
this._loadSessionKey(session);
|
||||||
@ -32,6 +33,7 @@ export class BaseRoomKey {
|
|||||||
|
|
||||||
async _isBetterThanKnown(session, olm, pickleKey, txn) {
|
async _isBetterThanKnown(session, olm, pickleKey, txn) {
|
||||||
let isBetter = true;
|
let isBetter = true;
|
||||||
|
// TODO: we could potentially have a small speedup here if we looked first in the SessionCache here...
|
||||||
const existingSessionEntry = await txn.inboundGroupSessions.get(this.roomId, this.senderKey, this.sessionId);
|
const existingSessionEntry = await txn.inboundGroupSessions.get(this.roomId, this.senderKey, this.sessionId);
|
||||||
if (existingSessionEntry?.session) {
|
if (existingSessionEntry?.session) {
|
||||||
const existingSession = new olm.InboundGroupSession();
|
const existingSession = new olm.InboundGroupSession();
|
||||||
|
Loading…
Reference in New Issue
Block a user