To calculate an ID, take the utf-8 message, convert it to utf-16, and then throw away the high bytes. Of course.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3834 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2022-02-11 02:44:27 +00:00
parent d4135f7133
commit 50bef73200
5 changed files with 63 additions and 10 deletions

View File

@ -219,7 +219,9 @@ function ebtReplicateSendClock(request, have) {
}
var to_send = {}
for (let id of ids) {
var offset = Math.floor(Math.random() * ids.length);
for (var i = 0; i < ids.length; i++) {
var id = ids[(i + offset) % ids.length];
if (last_sent[id] === undefined || message[id] > last_sent[id]) {
last_sent[id] = to_send[id] = message[id] === -1 ? -1 : message[id] << 1;
}