Skip to content

Commit

Permalink
Fix resend handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
jq-rs committed Apr 24, 2020
1 parent c41bf6f commit dac4d28
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions js/mlestalk.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ function hash_message(uid, data) {
return SipHash.hash_hex(gSipKey, uid + data);
}

function uidQueueGet(uid) {
return gUidQueue[uid];
function uidQueueGet(uid, channel) {
return gUidQueue[uid + channel];
}

function queueFindAndMatch(msgTimestamp, uid, channel, message) {
Expand Down Expand Up @@ -155,10 +155,11 @@ function queueSweepAndSend(uid, channel) {
}

function uidQueuePush(uid, channel, arr) {
if (!gUidQueue[uid+channel]) {
gUidQueue[uid+channel] = new Queue();
let q = uidQueueGet(uid, channel);
if (!q) {
gUidQueue[uid + channel] = new Queue();
q = uidQueueGet(uid, channel);
}
let q = gUidQueue[uid+channel];
q.push(arr);
}

Expand Down Expand Up @@ -793,7 +794,7 @@ function sendData(cmd, uid, channel, data, isFull, isImage, isMultipart, isFirst
gWebWorker.postMessage(arr);
}
if (gSipKeyIsOk && isFull && data.length > 0)
queuePostMsg(uid, [date, arr, hash_message(uid, data), isImage]);
queuePostMsg(uid, channel, [date, arr, hash_message(uid, data), isImage]);
}
}

Expand Down

0 comments on commit dac4d28

Please sign in to comment.