add logging to seq queueing

This commit is contained in:
Bruno Windels 2022-06-02 11:11:32 +02:00
parent 513c059459
commit a530944f7d

View file

@ -257,17 +257,25 @@ export class Member {
} }
const idx = sortedIndex(connection.queuedSignallingMessages, message, (a, b) => a.content.seq - b.content.seq); const idx = sortedIndex(connection.queuedSignallingMessages, message, (a, b) => a.content.seq - b.content.seq);
connection.queuedSignallingMessages.splice(idx, 0, message); connection.queuedSignallingMessages.splice(idx, 0, message);
let hasBeenDequeued = false;
if (connection.peerCall) { if (connection.peerCall) {
while ( while (
connection.queuedSignallingMessages.length && ( connection.queuedSignallingMessages.length && (
connection.lastProcessedSeqNr === undefined || connection.lastProcessedSeqNr === undefined ||
connection.queuedSignallingMessages[0].content.seq === connection.lastProcessedSeqNr + 1 connection.queuedSignallingMessages[0].content.seq === connection.lastProcessedSeqNr + 1
)) { )
) {
const dequeuedMessage = connection.queuedSignallingMessages.shift()!; const dequeuedMessage = connection.queuedSignallingMessages.shift()!;
const item = connection.peerCall!.handleIncomingSignallingMessage(dequeuedMessage, this.deviceId, connection.logItem); if (dequeuedMessage === message) {
connection.lastProcessedSeqNr = dequeuedMessage.content.seq; hasBeenDequeued = true;
syncLog.refDetached(item);
} }
const item = connection.peerCall!.handleIncomingSignallingMessage(dequeuedMessage, this.deviceId, connection.logItem);
syncLog.refDetached(item);
connection.lastProcessedSeqNr = dequeuedMessage.content.seq;
}
}
if (!hasBeenDequeued) {
syncLog.refDetached(connection.logItem.log({l: "queued signalling message", type: message.type}));
} }
} else { } else {
syncLog.log({l: "member not connected", userId: this.userId, deviceId: this.deviceId}); syncLog.log({l: "member not connected", userId: this.userId, deviceId: this.deviceId});