Split long clear timeout delays.

window.setTimeout can not handle big delays.

Fixes #180
This commit is contained in:
kkapsner 2018-02-16 18:10:18 +01:00
parent 10d9c022e0
commit 6f8f9a7e9c
2 changed files with 9 additions and 1 deletions

View File

@ -81,7 +81,14 @@
if (interval > 0){
var timeout = settings.lastPersistentRndClearing + interval - Date.now();
logging.message("registering persistent rng data clearing timeout. Clearing in ", timeout, "ms");
clearTimeout = window.setTimeout(clear, timeout);
if (timeout > 1073741824){
// window.setTimeout can only handle delays up to 32 bit.
// Therefore we repeat the registering afert 2^30 = 1073741824 seconds
clearTimeout = window.setTimeout(registerTimeout, 1073741824);
}
else {
clearTimeout = window.setTimeout(clear, timeout);
}
}
}
function broadcast(data){

View File

@ -8,6 +8,7 @@ Version 0.4.5:
- Added sections in options
fixes:
- long clearing periods did not work
- prevent possible double faking
- asking did not work in some cases (auto deny)