[tor-commits] [snowflake-webext/master] Recheck NAT type once every 2 days

cohosh at torproject.org cohosh at torproject.org
Wed Jan 27 17:13:28 UTC 2021


commit ac2ad2060b3d49bf8e2411e5a6ba4b8724aab566
Author: Cecylia Bocovich <cohosh at torproject.org>
Date:   Thu Jan 21 10:25:57 2021 -0500

    Recheck NAT type once every 2 days
---
 config.js      | 3 +++
 init-badge.js  | 2 +-
 init-webext.js | 4 ++--
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/config.js b/config.js
index b5db8b5..2e7555a 100644
--- a/config.js
+++ b/config.js
@@ -28,6 +28,9 @@ Config.prototype.defaultBrokerPollInterval = 60.0 * 1000; //1 poll every minutes
 Config.prototype.slowestBrokerPollInterval = 6 * 60 * 60.0 * 1000; //1 poll every 6 hours
 Config.prototype.pollAdjustment = 100.0 * 1000;
 
+// Recheck our NAT type once every 2 days
+Config.prototype.natCheckInterval = 2 * 24 * 60 * 60 * 1000;
+
 // Timeout after sending answer before datachannel is opened
 Config.prototype.datachannelTimeout = 20 * 1000;
 
diff --git a/init-badge.js b/init-badge.js
index 784ffc8..6233b10 100644
--- a/init-badge.js
+++ b/init-badge.js
@@ -157,7 +157,7 @@ var debug, snowflake, config, broker, ui, log, dbg, init, update, initNATType, s
         console.log(e);
       });
       // reset NAT type every 24 hours in case proxy location changed
-      setTimeout(_this.initNATType, 24 * 60 * 60 * 1000);
+      setTimeout(_this.initNATType, config.natCheckInterval);
     })(this);
   };
 
diff --git a/init-webext.js b/init-webext.js
index 8a756ec..d9a37d0 100644
--- a/init-webext.js
+++ b/init-webext.js
@@ -34,8 +34,8 @@ class WebExtUI extends UI {
       }).catch((e) => {
         console.log(e);
       });
-      // reset NAT type every 24 hours in case proxy location changed
-      setTimeout(_this.initNATType, 24 * 60 * 60 * 1000);
+      // reset NAT type every 2 days in case proxy location changed
+      setTimeout(_this.initNATType, config.natCheckInterval);
     })(this);
   }
 





More information about the tor-commits mailing list