1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

Fixed random bias.

This commit is contained in:
Ylian Saint-Hilaire 2021-02-08 18:23:29 -08:00
parent f7300b8b5b
commit 956fdd8ca8
2 changed files with 10 additions and 3 deletions

View file

@ -178,7 +178,8 @@ module.exports.CreateMultiServer = function (parent, args) {
// Get the next retry time in milliseconds
function getConnectRetryTime() {
if (obj.retryBackoff < 30000) { obj.retryBackoff += ((require('crypto').randomBytes(4).readUInt32BE(0) % 3000) + 1000); }
// The (random & 0x1FFF) creates a random number between 0 and 4096.
if (obj.retryBackoff < 30000) { obj.retryBackoff += ((require('crypto').randomBytes(4).readUInt32BE(0) & 0x1FFF) + 1000); }
return obj.retryBackoff;
}