From 6f8f9a7e9c45f8cf4d371d5f3f6f78c771e4d106 Mon Sep 17 00:00:00 2001 From: kkapsner Date: Fri, 16 Feb 2018 18:10:18 +0100 Subject: [PATCH] Split long clear timeout delays. window.setTimeout can not handle big delays. Fixes #180 --- lib/persistentRndStorage.js | 9 ++++++++- releaseNotes.txt | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/persistentRndStorage.js b/lib/persistentRndStorage.js index 758099c..ba1c8af 100644 --- a/lib/persistentRndStorage.js +++ b/lib/persistentRndStorage.js @@ -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){ diff --git a/releaseNotes.txt b/releaseNotes.txt index 033a8ba..3eb9a32 100644 --- a/releaseNotes.txt +++ b/releaseNotes.txt @@ -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)