[tbb-commits] [tor-browser] 28/33: fixup! fixup! Bug 40597: Implement TorSettings module

gitolite role git at cupani.torproject.org
Tue May 3 22:40:36 UTC 2022


This is an automated email from the git hooks/post-receive script.

richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1
in repository tor-browser.

commit ee7544dcb1c4318d39efdbffc5e0ce7a757e8548
Author: Pier Angelo Vendrame <pierov at torproject.org>
AuthorDate: Tue Apr 26 12:08:27 2022 +0200

    fixup! fixup! Bug 40597: Implement TorSettings module
    
    Changed the timeoutRand function, and fixed a typo.
---
 browser/modules/TorConnect.jsm | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/browser/modules/TorConnect.jsm b/browser/modules/TorConnect.jsm
index 59d59b70eaad8..711134326a14d 100644
--- a/browser/modules/TorConnect.jsm
+++ b/browser/modules/TorConnect.jsm
@@ -221,10 +221,6 @@ const InternetStatus = Object.freeze({
 });
 
 class InternetTest {
-    static get TIMEOUT() {
-        return 30000;
-    }
-
     constructor() {
         this._status = InternetStatus.Unknown;
         this._error = null;
@@ -232,7 +228,7 @@ class InternetTest {
         this._timeout = setTimeout(() => {
             this._timeout = null;
             this.test();
-        }, InternetTest.TIMEOUT + this.timeoutRand());
+        }, this.timeoutRand());
         this.onResult = (online, date) => {}
         this.onError = (err) => {};
     }
@@ -268,7 +264,7 @@ class InternetTest {
         // Callbacks for the Internet test are desirable, because we will be
         // waiting both for the bootstrap, and for the Internet test.
         // However, managing Moat with async/await is much easier as it avoids a
-        // callback hell, and it makes extra esplicit that we are uniniting it.
+        // callback hell, and it makes extra explicit that we are uniniting it.
         const mrpc = new MoatRPC();
         let status = null;
         let error = null;
@@ -297,8 +293,9 @@ class InternetTest {
 
     // We randomize the Internet test timeout to make fingerprinting it harder, at least a little bit...
     timeoutRand() {
-        const window = 5000;
-        return window * (Math.random() * 2 - 1);
+        const offset = 30000;
+        const randRange = 5000;
+        return offset + randRange * (Math.random() * 2 - 1);
     }
 }
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tbb-commits mailing list