From 1aa044667c812da212324761a3d2824a2ee5f135 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 8 Sep 2020 14:39:07 +0200 Subject: [PATCH] try sending out pending room keys after first sync --- src/matrix/Session.js | 2 +- src/matrix/room/Room.js | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/matrix/Session.js b/src/matrix/Session.js index 63b954af..b4cbf3b2 100644 --- a/src/matrix/Session.js +++ b/src/matrix/Session.js @@ -217,7 +217,7 @@ export class Session { this._sendScheduler.start(); for (const [, room] of this._rooms) { - room.resumeSending(); + room.start(); } } diff --git a/src/matrix/room/Room.js b/src/matrix/room/Room.js index 55bb1ccb..3c417082 100644 --- a/src/matrix/room/Room.js +++ b/src/matrix/room/Room.js @@ -217,7 +217,16 @@ export class Room extends EventEmitter { } /** @package */ - resumeSending() { + async start() { + if (this._roomEncryption) { + try { + // if we got interrupted last time sending keys to newly joined members + await this._roomEncryption.shareRoomKeyToPendingMembers(this._hsApi); + } catch (err) { + // we should not throw here + console.error(`could not send out pending room keys for room ${this.id}`, err.stack); + } + } this._sendQueue.resumeSending(); }