[tor-commits] [pluggable-transports/snowflake-webext] branch main updated: fix: occasional infinite `setTimeout(flush` loop

gitolite role git at cupani.torproject.org
Fri Dec 23 18:34:39 UTC 2022


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.

The following commit(s) were added to refs/heads/main by this push:
     new 2581cf1  fix: occasional infinite `setTimeout(flush` loop
2581cf1 is described below

commit 2581cf1e203ddd93942bafd35bc89e8d24e42ff2
Author: WofWca <wofwca at protonmail.com>
AuthorDate: Wed Nov 9 15:44:04 2022 +0400

    fix: occasional infinite `setTimeout(flush` loop
    
    Happens if a channel gets closed while its buffer array
    (e.g. `r2cSchedule`) is not empty.
---
 proxypair.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/proxypair.js b/proxypair.js
index 07670fb..b4dc3c9 100644
--- a/proxypair.js
+++ b/proxypair.js
@@ -255,6 +255,7 @@ class ProxyPair {
     clearTimeout(this.connectToRelayTimeoutId);
     clearTimeout(this.messageTimer);
     clearTimeout(this.answerTimeoutId);
+    clearTimeout(this.flush_timeout_id);
     if (this.webrtcIsReady()) {
       this.client.close();
     }
@@ -293,7 +294,7 @@ class ProxyPair {
 
     if (this.flush_timeout_id) {
       clearTimeout(this.flush_timeout_id);
-      this.flush_timeout_id = null;
+      this.flush_timeout_id = 0;
     }
     if (this.r2cSchedule.length > 0 || this.c2rSchedule.length > 0) {
       this.flush_timeout_id = setTimeout(this.flush, this.rateLimit.when() * 1000);
@@ -330,6 +331,6 @@ ProxyPair.prototype.relay = null; // websocket
 ProxyPair.prototype.connectToRelayTimeoutId = 0;
 ProxyPair.prototype.messageTimer = 0;
 ProxyPair.prototype.answerTimeoutId = 0;
-ProxyPair.prototype.flush_timeout_id = null;
+ProxyPair.prototype.flush_timeout_id = 0;
 
 ProxyPair.prototype.onCleanup = null;

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


More information about the tor-commits mailing list