This is an automated email from the git hooks/post-receive script.
cohosh pushed a change to branch main in repository pluggable-transports/snowflake-webext.
from fd545a0 Update npm package and dependencies new bf3d845 perf: do `flush()` before less important stuff new 38f54a2 perf: reorder `if` conditions new 37e8557 perf: ProxyPair: do `.send(` before less important stuff new 4447f61 perf: inline a function definition inside `flush()` new 4859a70 perf: ProxyPair: do `.send(` before less important stuff (again) new ec979a9 perf: don't perform `flush_timeout_id = null` when it's already `null`
The 6 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
Summary of changes: proxypair.js | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-)
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 bf3d845633c98ce2da51a97dc5241341e2975581 Author: WofWca wofwca@protonmail.com AuthorDate: Fri Jul 15 18:22:04 2022 +0300
perf: do `flush()` before less important stuff
This setTimeout was introduced in 37f168881 --- proxypair.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/proxypair.js b/proxypair.js index 481d0cd..1957301 100644 --- a/proxypair.js +++ b/proxypair.js @@ -171,10 +171,9 @@ class ProxyPair { onClientToRelayMessage(msg) { dbg('WebRTC --> websocket data: ' + msg.data.byteLength + ' bytes'); this.c2rSchedule.push(msg.data); + this.flush();
this.refreshStaleTimeout(); - - this.flush(); }
/**
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 38f54a2a12ac5bf255aa919eed1aa753c3e86c10 Author: WofWca wofwca@protonmail.com AuthorDate: Fri Jul 15 18:40:54 2022 +0300
perf: reorder `if` conditions
Put the one that is more likely to be `false` at the beginning --- proxypair.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/proxypair.js b/proxypair.js index 1957301..4d012d0 100644 --- a/proxypair.js +++ b/proxypair.js @@ -218,14 +218,14 @@ class ProxyPair { const checkChunks = () => { busy = false; // WebRTC --> websocket - if (this.relayIsReady() && this.relay.bufferedAmount < this.MAX_BUFFER && this.c2rSchedule.length > 0) { + 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); busy = true; } // websocket --> WebRTC - if (this.webrtcIsReady() && this.client.bufferedAmount < this.MAX_BUFFER && this.r2cSchedule.length > 0) { + 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 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@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; } };
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@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);
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@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); }
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 ec979a9316bfd81da1a38cf84bdf82ef1498dfc1 Author: WofWca wofwca@protonmail.com AuthorDate: Fri Jul 15 19:23:02 2022 +0300
perf: don't perform `flush_timeout_id = null` when it's already `null` --- proxypair.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/proxypair.js b/proxypair.js index 2189e9c..716aa7a 100644 --- a/proxypair.js +++ b/proxypair.js @@ -231,8 +231,8 @@ class ProxyPair {
if (this.flush_timeout_id) { clearTimeout(this.flush_timeout_id); + this.flush_timeout_id = null; } - 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); }
tor-commits@lists.torproject.org