[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [pluggable-transports/snowflake-webext] 07/15: refactor: reorder lines



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

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

commit 833efcac57f3d3fd4dd5c22cc60777bae0ee5917
Author: WofWca <wofwca@xxxxxxxxxxxxxx>
AuthorDate: Sun Nov 6 12:41:27 2022 +0400

    refactor: reorder lines
---
 proxypair.js | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/proxypair.js b/proxypair.js
index 27e6bcc..bd128c8 100644
--- a/proxypair.js
+++ b/proxypair.js
@@ -117,23 +117,22 @@ class ProxyPair {
    * @private
    */
   prepareDataChannel(channel) {
-    // if we don't receive any keep-alive messages from the client, close the
-    // connection
-    const onStaleTimeout = () => {
-      console.log("Closing stale connection.");
-      this.flush();
-      this.close();
-    };
-    this.refreshStaleTimeout = () => {
-      clearTimeout(this.messageTimer);
-      this.messageTimer = setTimeout(onStaleTimeout, this.config.messageTimeout);
-    };
-
     channel.onopen = () => {
       log('WebRTC DataChannel opened!');
       snowflake.ui.increaseClients();
       this.counted = true;
 
+      // if we don't receive any keep-alive messages from the client, close the
+      // connection
+      const onStaleTimeout = () => {
+        console.log("Closing stale connection.");
+        this.flush();
+        this.close();
+      };
+      this.refreshStaleTimeout = () => {
+        clearTimeout(this.messageTimer);
+        this.messageTimer = setTimeout(onStaleTimeout, this.config.messageTimeout);
+      };
       this.refreshStaleTimeout();
 
       // This is the point when the WebRTC datachannel is done, so the next step

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits