This is an automated email from the git hooks/post-receive script.
meskio pushed a change to branch main in repository pluggable-transports/snowflake-webext.
from 45af793 fix for #45: stats repaired new 49c5670 refactor: make 'At client capacity' logic clearer new c64170d refactor: rename a var new 8a06433 refactor: remove some unnecessary checks new 4a178c8 Merge remote-tracking branch 'origin/mr/38'
The 4 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 | 26 ++++++-------------------- snowflake.js | 9 +++------ 2 files changed, 9 insertions(+), 26 deletions(-)
This is an automated email from the git hooks/post-receive script.
meskio pushed a commit to branch main in repository pluggable-transports/snowflake-webext.
commit 49c56703e1dbd5f5ebc17efe309a780b01202055 Author: WofWca wofwca@protonmail.com AuthorDate: Fri Jul 15 16:06:18 2022 +0300
refactor: make 'At client capacity' logic clearer --- snowflake.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/snowflake.js b/snowflake.js index b55a3bd..8685753 100644 --- a/snowflake.js +++ b/snowflake.js @@ -65,11 +65,11 @@ class Snowflake { */ pollBroker() { // Poll broker for clients. - const pair = this.makeProxyPair(); - if (!pair) { + if (this.proxyPairs.length >= this.config.maxNumClients) { log('At client capacity.'); return; } + const pair = this.makeProxyPair(); log('Polling broker..'); // Do nothing until a new proxyPair is available. let msg = 'Polling for client ... '; @@ -178,12 +178,9 @@ class Snowflake { }
/** - * @returns {null | ProxyPair} + * @returns {ProxyPair} */ makeProxyPair() { - if (this.proxyPairs.length >= this.config.maxNumClients) { - return null; - } const pair = new ProxyPair(this.relayAddr, this.rateLimit, this.config); this.proxyPairs.push(pair);
This is an automated email from the git hooks/post-receive script.
meskio pushed a commit to branch main in repository pluggable-transports/snowflake-webext.
commit c64170da47ba9cb06598e72100161c228129bcab Author: WofWca wofwca@protonmail.com AuthorDate: Thu Jul 21 17:07:06 2022 +0300
refactor: rename a var --- proxypair.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/proxypair.js b/proxypair.js index 41e6291..a055714 100644 --- a/proxypair.js +++ b/proxypair.js @@ -126,9 +126,9 @@ class ProxyPair { WS.makeWebsocketFromURL(this.relayURL, params); this.relay.label = 'websocket-relay'; this.relay.onopen = () => { - if (this.timer) { - clearTimeout(this.timer); - this.timer = 0; + if (this.connectToRelayTimeoutId) { + clearTimeout(this.connectToRelayTimeoutId); + this.connectToRelayTimeoutId = 0; } log(relay.label + ' connected!'); snowflake.ui.setStatus('connected'); @@ -146,8 +146,8 @@ class ProxyPair { this.relay.onerror = this.onError; this.relay.onmessage = this.onRelayToClientMessage; // TODO: Better websocket timeout handling. - this.timer = setTimeout((() => { - if (0 === this.timer) { + this.connectToRelayTimeoutId = setTimeout((() => { + if (0 === this.connectToRelayTimeoutId) { return; } log(relay.label + ' timed out connecting.'); @@ -194,9 +194,9 @@ class ProxyPair {
/** Close both WebRTC and websocket. */ close() { - if (this.timer) { - clearTimeout(this.timer); - this.timer = 0; + if (this.connectToRelayTimeoutId) { + clearTimeout(this.connectToRelayTimeoutId); + this.connectToRelayTimeoutId = 0; } if (this.messageTimer) { clearTimeout(this.messageTimer); @@ -280,7 +280,7 @@ ProxyPair.prototype.pc = null; ProxyPair.prototype.client = null; // WebRTC Data channel ProxyPair.prototype.relay = null; // websocket
-ProxyPair.prototype.timer = 0; +ProxyPair.prototype.connectToRelayTimeoutId = 0; ProxyPair.prototype.messageTimer = 0; ProxyPair.prototype.flush_timeout_id = null;
This is an automated email from the git hooks/post-receive script.
meskio pushed a commit to branch main in repository pluggable-transports/snowflake-webext.
commit 8a064332d9d48175dd6c3ad8dafff1818a60ce35 Author: WofWca wofwca@protonmail.com AuthorDate: Thu Jul 21 17:12:09 2022 +0300
refactor: remove some unnecessary checks --- proxypair.js | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-)
diff --git a/proxypair.js b/proxypair.js index a055714..dcd8433 100644 --- a/proxypair.js +++ b/proxypair.js @@ -126,10 +126,7 @@ class ProxyPair { WS.makeWebsocketFromURL(this.relayURL, params); this.relay.label = 'websocket-relay'; this.relay.onopen = () => { - if (this.connectToRelayTimeoutId) { - clearTimeout(this.connectToRelayTimeoutId); - this.connectToRelayTimeoutId = 0; - } + clearTimeout(this.connectToRelayTimeoutId); log(relay.label + ' connected!'); snowflake.ui.setStatus('connected'); }; @@ -147,9 +144,6 @@ class ProxyPair { this.relay.onmessage = this.onRelayToClientMessage; // TODO: Better websocket timeout handling. this.connectToRelayTimeoutId = setTimeout((() => { - if (0 === this.connectToRelayTimeoutId) { - return; - } log(relay.label + ' timed out connecting.'); relay.onclose(); }), 5000); @@ -160,9 +154,7 @@ class ProxyPair { * @param {MessageEvent} msg */ onClientToRelayMessage(msg) { - if (this.messageTimer) { - clearTimeout(this.messageTimer); - } + clearTimeout(this.messageTimer); dbg('WebRTC --> websocket data: ' + msg.data.byteLength + ' bytes'); this.c2rSchedule.push(msg.data);
@@ -194,14 +186,8 @@ class ProxyPair {
/** Close both WebRTC and websocket. */ close() { - if (this.connectToRelayTimeoutId) { - clearTimeout(this.connectToRelayTimeoutId); - this.connectToRelayTimeoutId = 0; - } - if (this.messageTimer) { - clearTimeout(this.messageTimer); - this.messageTimer = 0; - } + clearTimeout(this.connectToRelayTimeoutId); + clearTimeout(this.messageTimer); if (this.webrtcIsReady()) { this.client.close(); }
This is an automated email from the git hooks/post-receive script.
meskio pushed a commit to branch main in repository pluggable-transports/snowflake-webext.
commit 4a178c81f02fe6d1bb4804ffefcac37d893e1942 Merge: 45af793 8a06433 Author: meskio meskio@torproject.org AuthorDate: Mon Aug 22 18:20:50 2022 +0200
Merge remote-tracking branch 'origin/mr/38'
proxypair.js | 26 ++++++-------------------- snowflake.js | 9 +++------ 2 files changed, 9 insertions(+), 26 deletions(-)
tor-commits@lists.torproject.org