[tor-commits] [snowflake/master] Remove property "running" from proxy-pair

cohosh at torproject.org cohosh at torproject.org
Thu Oct 31 16:00:22 UTC 2019


commit d186fcd40103913bf06358e5dd47c0c776e07534
Author: Cecylia Bocovich <cohosh at torproject.org>
Date:   Fri Oct 18 16:58:54 2019 -0400

    Remove property "running" from proxy-pair
    
    We don't need it, and already have a function webrtcIsReady that tells
    us what we need to know (whether a datachannel was opened before the
    timeout period).
---
 proxy/proxypair.js | 4 ----
 proxy/snowflake.js | 2 +-
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/proxy/proxypair.js b/proxy/proxypair.js
index 9f6a7b2..64eafdc 100644
--- a/proxy/proxypair.js
+++ b/proxy/proxypair.js
@@ -88,7 +88,6 @@ class ProxyPair {
       if (!this.active) {
         return;
       }
-      this.running = true;
       snowflake.ui.setActive(true);
       // This is the point when the WebRTC datachannel is done, so the next step
       // is to establish websocket to the server.
@@ -191,7 +190,6 @@ class ProxyPair {
     this.relay = null;
     this.onCleanup();
     this.active = false;
-    this.running = false;
   }
 
   flush() {
@@ -255,8 +253,6 @@ ProxyPair.prototype.relay = null; // websocket
 
 ProxyPair.prototype.timer = 0;
 
-ProxyPair.prototype.running = false; // Whether a datachannel is opened
-
 ProxyPair.prototype.active = false; // Whether serving a client.
 
 ProxyPair.prototype.flush_timeout_id = null;
diff --git a/proxy/snowflake.js b/proxy/snowflake.js
index 78b1d0e..c647b4e 100644
--- a/proxy/snowflake.js
+++ b/proxy/snowflake.js
@@ -78,7 +78,7 @@ class Snowflake {
         }
         //set a timeout for channel creation
         return setTimeout((() => {
-          if (!pair.running) {
+          if (!pair.webrtcIsReady()) {
             log('proxypair datachannel timed out waiting for open');
             pair.close();
             return pair.active = false;





More information about the tor-commits mailing list