[tor-commits] [pluggable-transports/snowflake-webext] 02/04: refactor: rename a var

gitolite role git at cupani.torproject.org
Mon Aug 22 16:21:04 UTC 2022


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

meskio pushed a commit to branch main
in repository pluggable-transports/snowflake-webext.

commit c64170da47ba9cb06598e72100161c228129bcab
Author: WofWca <wofwca at protonmail.com>
AuthorDate: Thu Jul 21 17:07:06 2022 +0300

    refactor: rename a var
---
 proxypair.js | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/proxypair.js b/proxypair.js
index 41e6291..a055714 100644
--- a/proxypair.js
+++ b/proxypair.js
@@ -126,9 +126,9 @@ class ProxyPair {
         WS.makeWebsocketFromURL(this.relayURL, params);
     this.relay.label = 'websocket-relay';
     this.relay.onopen = () => {
-      if (this.timer) {
-        clearTimeout(this.timer);
-        this.timer = 0;
+      if (this.connectToRelayTimeoutId) {
+        clearTimeout(this.connectToRelayTimeoutId);
+        this.connectToRelayTimeoutId = 0;
       }
       log(relay.label + ' connected!');
       snowflake.ui.setStatus('connected');
@@ -146,8 +146,8 @@ class ProxyPair {
     this.relay.onerror = this.onError;
     this.relay.onmessage = this.onRelayToClientMessage;
     // TODO: Better websocket timeout handling.
-    this.timer = setTimeout((() => {
-      if (0 === this.timer) {
+    this.connectToRelayTimeoutId = setTimeout((() => {
+      if (0 === this.connectToRelayTimeoutId) {
         return;
       }
       log(relay.label + ' timed out connecting.');
@@ -194,9 +194,9 @@ class ProxyPair {
 
   /** Close both WebRTC and websocket. */
   close() {
-    if (this.timer) {
-      clearTimeout(this.timer);
-      this.timer = 0;
+    if (this.connectToRelayTimeoutId) {
+      clearTimeout(this.connectToRelayTimeoutId);
+      this.connectToRelayTimeoutId = 0;
     }
     if (this.messageTimer) {
       clearTimeout(this.messageTimer);
@@ -280,7 +280,7 @@ ProxyPair.prototype.pc = null;
 ProxyPair.prototype.client = null; // WebRTC Data channel
 ProxyPair.prototype.relay = null; // websocket
 
-ProxyPair.prototype.timer = 0;
+ProxyPair.prototype.connectToRelayTimeoutId = 0;
 ProxyPair.prototype.messageTimer = 0;
 ProxyPair.prototype.flush_timeout_id = null;
 

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


More information about the tor-commits mailing list