diff --git a/src/client.js b/src/client.js index abd65eb9d..854b6ac2b 100644 --- a/src/client.js +++ b/src/client.js @@ -941,6 +941,8 @@ MatrixClient.prototype.sendEvent = function(roomId, eventType, content, txnId, txnId = this.makeTxnId(); } + console.log(`sendEvent of type ${eventType} in ${roomId} with txnId ${txnId}`); + // we always construct a MatrixEvent when sending because the store and // scheduler use them. We'll extract the params back out if it turns out // the client has no scheduler or store. @@ -1065,7 +1067,12 @@ function _sendEventHttpRequest(client, event) { return client._http.authedRequest( undefined, "PUT", path, undefined, event.getWireContent(), - ); + ).then((res) => { + console.log( + `Event sent to ${event.getRoomId()} with event id ${res.event_id}`, + ); + return res; + }); } /** diff --git a/src/crypto/DeviceList.js b/src/crypto/DeviceList.js index e3d55e318..2b608475b 100644 --- a/src/crypto/DeviceList.js +++ b/src/crypto/DeviceList.js @@ -76,6 +76,10 @@ export default class DeviceList { if (this._keyDownloadsInProgressByUser[u]) { // already a key download in progress/queued for this user; its results // will be good enough for us. + console.log( + `downloadKeys: already have a download in progress for ` + + `${u}: awaiting its result`, + ); promises.push(this._keyDownloadsInProgressByUser[u]); } else if (forceDownload || trackingStatus != TRACKING_STATUS_UP_TO_DATE) { usersToDownload.push(u); @@ -88,6 +92,10 @@ export default class DeviceList { promises.push(downloadPromise); } + if (promises.length === 0) { + console.log("downloadKeys: already have all necessary keys"); + } + return q.all(promises).then(() => { return this._getDevicesFromStore(userIds); }); diff --git a/src/crypto/algorithms/megolm.js b/src/crypto/algorithms/megolm.js index f7d7b770e..0e65b4f23 100644 --- a/src/crypto/algorithms/megolm.js +++ b/src/crypto/algorithms/megolm.js @@ -183,6 +183,7 @@ MegolmEncryption.prototype._ensureOutboundSession = function(devicesInRoom) { } if (!session) { + console.log(`Starting new megolm session for room ${self._roomId}`); session = self._prepareNewSession(); } @@ -353,6 +354,8 @@ MegolmEncryption.prototype._shareKeyWithDevices = function(session, devicesByUse // TODO: retries return self._baseApis.sendToDevice("m.room.encrypted", contentMap); }).then(function() { + console.log(`Completed megolm keyshare in ${self._roomId}`); + // Add the devices we have shared with to session.sharedWithDevices. // // we deliberately iterate over devicesByUser (ie, the devices we @@ -387,6 +390,8 @@ MegolmEncryption.prototype._shareKeyWithDevices = function(session, devicesByUse */ MegolmEncryption.prototype.encryptMessage = function(room, eventType, content) { const self = this; + console.log(`Starting to encrypt event for ${this._roomId}`); + return this._getDevicesInRoom(room).then(function(devicesInRoom) { // check if any of these devices are not yet known to the user. // if so, warn the user so they can verify or ignore. diff --git a/src/models/room.js b/src/models/room.js index 1d0d7d97f..a1f88cd7c 100644 --- a/src/models/room.js +++ b/src/models/room.js @@ -752,6 +752,8 @@ ALLOWED_TRANSITIONS[EventStatus.CANCELLED] = * @fires module:client~MatrixClient#event:"Room.localEchoUpdated" */ Room.prototype.updatePendingEvent = function(event, newStatus, newEventId) { + console.log(`setting pendingEvent status to ${newStatus} in ${event.getRoomId()}`); + // if the message was sent, we expect an event id if (newStatus == EventStatus.SENT && !newEventId) { throw new Error("updatePendingEvent called with status=SENT, " +