[tor-commits] [pluggable-transports/snowflake-webext] 03/06: perf: ProxyPair: do `.send(` before less important stuff

gitolite role git at cupani.torproject.org
Thu Nov 3 17:15:59 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 37e85578eff29e696bf902d9e800fb915464a26d
Author: WofWca <wofwca at protonmail.com>
AuthorDate: Fri Jul 15 18:56:39 2022 +0300

    perf: ProxyPair: do `.send(` before less important stuff
---
 proxypair.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/proxypair.js b/proxypair.js
index 4d012d0..763dc2d 100644
--- a/proxypair.js
+++ b/proxypair.js
@@ -220,15 +220,15 @@ class ProxyPair {
       // WebRTC --> websocket
       if (this.c2rSchedule.length > 0 && this.relayIsReady() && this.relay.bufferedAmount < this.MAX_BUFFER) {
         const chunk = this.c2rSchedule.shift();
-        this.rateLimit.update(chunk.byteLength);
         this.relay.send(chunk);
+        this.rateLimit.update(chunk.byteLength);
         busy = true;
       }
       // websocket --> WebRTC
       if (this.r2cSchedule.length > 0 && this.webrtcIsReady() && this.client.bufferedAmount < this.MAX_BUFFER) {
         const chunk = this.r2cSchedule.shift();
-        this.rateLimit.update(chunk.byteLength);
         this.client.send(chunk);
+        this.rateLimit.update(chunk.byteLength);
         busy = true;
       }
     };

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


More information about the tor-commits mailing list