mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20: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) {
|
||||
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.onopen = () => {
|
||||
if (this.timer) {
|
||||
clearTimeout(this.timer);
|
||||
this.timer = 0;
|
||||
}
|
||||
log(this.relay.label + ' connected!');
|
||||
log(relay.label + ' connected!');
|
||||
return snowflake.ui.setStatus('connected');
|
||||
};
|
||||
this.relay.onclose = () => {
|
||||
log(this.relay.label + ' closed.');
|
||||
log(relay.label + ' closed.');
|
||||
snowflake.ui.setStatus('disconnected.');
|
||||
snowflake.ui.setActive(false);
|
||||
snowflake.state = Snowflake.MODE.INIT;
|
||||
|
@ -146,8 +146,8 @@ class ProxyPair {
|
|||
if (0 === this.timer) {
|
||||
return;
|
||||
}
|
||||
log(this.relay.label + ' timed out connecting.');
|
||||
return this.relay.onclose();
|
||||
log(relay.label + ' timed out connecting.');
|
||||
return relay.onclose();
|
||||
}), 5000);
|
||||
}
|
||||
|
||||
|
@ -172,7 +172,6 @@ class ProxyPair {
|
|||
|
||||
// Close both WebRTC and websocket.
|
||||
close() {
|
||||
var relay;
|
||||
if (this.timer) {
|
||||
clearTimeout(this.timer);
|
||||
this.timer = 0;
|
||||
|
@ -181,11 +180,12 @@ class ProxyPair {
|
|||
if (this.webrtcIsReady()) {
|
||||
this.client.close();
|
||||
}
|
||||
this.client = null;
|
||||
if (this.relayIsReady()) {
|
||||
this.relay.close();
|
||||
}
|
||||
relay = null;
|
||||
return this.onCleanup();
|
||||
this.relay = null;
|
||||
this.onCleanup();
|
||||
}
|
||||
|
||||
flush() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue