[tor-commits] [pluggable-transports/snowflake-webext] 05/06: perf: ProxyPair: do `.send(` before less important stuff (again)
gitolite role
git at cupani.torproject.org
Thu Nov 3 17:16:01 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 4859a70f75bda31542d59bdf023edb14a05b580a
Author: WofWca <wofwca at protonmail.com>
AuthorDate: Fri Jul 15 19:16:03 2022 +0300
perf: ProxyPair: do `.send(` before less important stuff (again)
---
proxypair.js | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/proxypair.js b/proxypair.js
index 431866c..2189e9c 100644
--- a/proxypair.js
+++ b/proxypair.js
@@ -210,10 +210,6 @@ class ProxyPair {
/** Send as much data in both directions as the rate limit currently allows. */
flush() {
- if (this.flush_timeout_id) {
- clearTimeout(this.flush_timeout_id);
- }
- this.flush_timeout_id = null;
let busy = true;
while (busy && !this.rateLimit.isLimited()) {
busy = false;
@@ -232,6 +228,11 @@ class ProxyPair {
busy = true;
}
}
+
+ if (this.flush_timeout_id) {
+ clearTimeout(this.flush_timeout_id);
+ }
+ this.flush_timeout_id = null;
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