@zhanguym/chatroom 1.2.0-beta.2 → 1.2.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/native/macos/ChatRoomComputerHelper.app/Contents/MacOS/chatroom-computer-helper
CHANGED
|
Binary file
|
|
Binary file
|
|
@@ -26,6 +26,7 @@ export class V2TunnelClient {
|
|
|
26
26
|
readyTimer = null;
|
|
27
27
|
heartbeatTimer = null;
|
|
28
28
|
awaitingPong = false;
|
|
29
|
+
failureReported = false;
|
|
29
30
|
stopped = true;
|
|
30
31
|
attempts = 0;
|
|
31
32
|
closeWhenIdle = null;
|
|
@@ -89,6 +90,7 @@ export class V2TunnelClient {
|
|
|
89
90
|
connect() {
|
|
90
91
|
if (this.stopped || this.socket)
|
|
91
92
|
return;
|
|
93
|
+
this.failureReported = false;
|
|
92
94
|
const socket = new WebSocket(this.lease.tunnelUrl, V2_PROTOCOL);
|
|
93
95
|
this.socket = socket;
|
|
94
96
|
let ready = false;
|
|
@@ -99,9 +101,7 @@ export class V2TunnelClient {
|
|
|
99
101
|
? new Error("Cloud Server does not support Tunnel V2; upgrade the server")
|
|
100
102
|
: new Error("Tunnel V2 handshake rejected: " + response.statusCode);
|
|
101
103
|
response.resume();
|
|
102
|
-
this.
|
|
103
|
-
this.stop();
|
|
104
|
-
socket.terminate();
|
|
104
|
+
this.fail(socket, error);
|
|
105
105
|
});
|
|
106
106
|
socket.on("open", () => {
|
|
107
107
|
if (socket.protocol !== V2_PROTOCOL)
|
|
@@ -145,10 +145,10 @@ export class V2TunnelClient {
|
|
|
145
145
|
this.awaitingPong = false;
|
|
146
146
|
});
|
|
147
147
|
socket.on("close", (code) => {
|
|
148
|
-
if (this.socket
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
148
|
+
if (this.socket !== socket)
|
|
149
|
+
return;
|
|
150
|
+
this.clearTimers();
|
|
151
|
+
this.socket = null;
|
|
152
152
|
this.closeWhenIdle = null;
|
|
153
153
|
this.destroyStreams();
|
|
154
154
|
this.callbacks.onDisconnected();
|
|
@@ -364,11 +364,11 @@ export class V2TunnelClient {
|
|
|
364
364
|
this.heartbeatTimer.unref();
|
|
365
365
|
}
|
|
366
366
|
fail(socket, error) {
|
|
367
|
-
if (this.socket !== socket)
|
|
367
|
+
if (this.socket !== socket || this.failureReported)
|
|
368
368
|
return;
|
|
369
|
+
this.failureReported = true;
|
|
369
370
|
this.callbacks.onError(error);
|
|
370
371
|
this.clearTimers();
|
|
371
|
-
this.socket = null;
|
|
372
372
|
socket.terminate();
|
|
373
373
|
}
|
|
374
374
|
scheduleReconnect() {
|