[tor-commits] [pluggable-transports/snowflake-webext] 04/06: perf: inline a function definition inside `flush()`

gitolite role git at cupani.torproject.org
Thu Nov 3 17:16:00 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.

commit 4447f6189a83046b5e60832cb60d03f3e99c1684
Author: WofWca <wofwca at protonmail.com>
AuthorDate: Fri Jul 15 19:13:11 2022 +0300

    perf: inline a function definition inside `flush()`
---
 proxypair.js | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/proxypair.js b/proxypair.js
index 763dc2d..431866c 100644
--- a/proxypair.js
+++ b/proxypair.js
@@ -215,7 +215,7 @@ class ProxyPair {
     }
     this.flush_timeout_id = null;
     let busy = true;
-    const checkChunks = () => {
+    while (busy && !this.rateLimit.isLimited()) {
       busy = false;
       // WebRTC --> websocket
       if (this.c2rSchedule.length > 0 && this.relayIsReady() && this.relay.bufferedAmount < this.MAX_BUFFER) {
@@ -231,9 +231,6 @@ class ProxyPair {
         this.rateLimit.update(chunk.byteLength);
         busy = true;
       }
-    };
-    while (busy && !this.rateLimit.isLimited()) {
-      checkChunks();
     }
     if (this.r2cSchedule.length > 0 || this.c2rSchedule.length > 0 || (this.relayIsReady() && this.relay.bufferedAmount > 0) || (this.webrtcIsReady() && this.client.bufferedAmount > 0)) {
       this.flush_timeout_id = setTimeout(this.flush, this.rateLimit.when() * 1000);

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


More information about the tor-commits mailing list