mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
Null out relay after closing
This was probably meant to be `@relay = null` is the coffeescript.
This commit is contained in:
parent
fb0578d840
commit
c12fcbeb85
1 changed files with 8 additions and 8 deletions
|
@ -121,18 +121,18 @@ class ProxyPair {
|
||||||
if (peer_ip != null) {
|
if (peer_ip != null) {
|
||||||
params.push(["client_ip", peer_ip]);
|
params.push(["client_ip", peer_ip]);
|
||||||
}
|
}
|
||||||
this.relay = WS.makeWebsocket(this.relayAddr, params);
|
var relay = this.relay = WS.makeWebsocket(this.relayAddr, params);
|
||||||
this.relay.label = 'websocket-relay';
|
this.relay.label = 'websocket-relay';
|
||||||
this.relay.onopen = () => {
|
this.relay.onopen = () => {
|
||||||
if (this.timer) {
|
if (this.timer) {
|
||||||
clearTimeout(this.timer);
|
clearTimeout(this.timer);
|
||||||
this.timer = 0;
|
this.timer = 0;
|
||||||
}
|
}
|
||||||
log(this.relay.label + ' connected!');
|
log(relay.label + ' connected!');
|
||||||
return snowflake.ui.setStatus('connected');
|
return snowflake.ui.setStatus('connected');
|
||||||
};
|
};
|
||||||
this.relay.onclose = () => {
|
this.relay.onclose = () => {
|
||||||
log(this.relay.label + ' closed.');
|
log(relay.label + ' closed.');
|
||||||
snowflake.ui.setStatus('disconnected.');
|
snowflake.ui.setStatus('disconnected.');
|
||||||
snowflake.ui.setActive(false);
|
snowflake.ui.setActive(false);
|
||||||
snowflake.state = Snowflake.MODE.INIT;
|
snowflake.state = Snowflake.MODE.INIT;
|
||||||
|
@ -146,8 +146,8 @@ class ProxyPair {
|
||||||
if (0 === this.timer) {
|
if (0 === this.timer) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
log(this.relay.label + ' timed out connecting.');
|
log(relay.label + ' timed out connecting.');
|
||||||
return this.relay.onclose();
|
return relay.onclose();
|
||||||
}), 5000);
|
}), 5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +172,6 @@ class ProxyPair {
|
||||||
|
|
||||||
// Close both WebRTC and websocket.
|
// Close both WebRTC and websocket.
|
||||||
close() {
|
close() {
|
||||||
var relay;
|
|
||||||
if (this.timer) {
|
if (this.timer) {
|
||||||
clearTimeout(this.timer);
|
clearTimeout(this.timer);
|
||||||
this.timer = 0;
|
this.timer = 0;
|
||||||
|
@ -181,11 +180,12 @@ class ProxyPair {
|
||||||
if (this.webrtcIsReady()) {
|
if (this.webrtcIsReady()) {
|
||||||
this.client.close();
|
this.client.close();
|
||||||
}
|
}
|
||||||
|
this.client = null;
|
||||||
if (this.relayIsReady()) {
|
if (this.relayIsReady()) {
|
||||||
this.relay.close();
|
this.relay.close();
|
||||||
}
|
}
|
||||||
relay = null;
|
this.relay = null;
|
||||||
return this.onCleanup();
|
this.onCleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
flush() {
|
flush() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue