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

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



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@xxxxxxxxxxxxxx>
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.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits