@mclawnet/agent 0.6.28 → 0.6.29
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/{chunk-NQ3WFEXY.js → chunk-Y4J44CKF.js} +16 -4
- package/dist/chunk-Y4J44CKF.js.map +1 -0
- package/dist/hub-connection.d.ts +6 -1
- package/dist/hub-connection.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/start.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-NQ3WFEXY.js.map +0 -1
|
@@ -1205,14 +1205,26 @@ var HubConnection = class {
|
|
|
1205
1205
|
*
|
|
1206
1206
|
* We `removeAllListeners()` before terminating so the close handler can't
|
|
1207
1207
|
* also call `scheduleReconnect()` — single-entry reconnect is easier to
|
|
1208
|
-
* reason about than relying on the timer-slot idempotency check.
|
|
1208
|
+
* reason about than relying on the timer-slot idempotency check. We then
|
|
1209
|
+
* re-attach a no-op `error` listener: terminating a socket still in
|
|
1210
|
+
* CONNECTING state (very common right after a wake — the post-sleep
|
|
1211
|
+
* reconnect attempt may not have completed the handshake yet) emits an
|
|
1212
|
+
* asynchronous `error` event, and an unhandled `error` on a WebSocket
|
|
1213
|
+
* (which extends EventEmitter) crashes the whole process.
|
|
1209
1214
|
*/
|
|
1210
1215
|
terminateAndReconnect(reason) {
|
|
1211
1216
|
this.stopHeartbeat();
|
|
1212
1217
|
if (this.ws) {
|
|
1213
|
-
this.ws
|
|
1218
|
+
const ws = this.ws;
|
|
1219
|
+
ws.removeAllListeners();
|
|
1220
|
+
ws.on("error", () => {
|
|
1221
|
+
});
|
|
1214
1222
|
try {
|
|
1215
|
-
|
|
1223
|
+
if (ws.readyState === WebSocket.CONNECTING) {
|
|
1224
|
+
ws.close();
|
|
1225
|
+
} else {
|
|
1226
|
+
ws.terminate();
|
|
1227
|
+
}
|
|
1216
1228
|
} catch {
|
|
1217
1229
|
}
|
|
1218
1230
|
this.ws = null;
|
|
@@ -3185,4 +3197,4 @@ export {
|
|
|
3185
3197
|
FsBridge,
|
|
3186
3198
|
startAgent
|
|
3187
3199
|
};
|
|
3188
|
-
//# sourceMappingURL=chunk-
|
|
3200
|
+
//# sourceMappingURL=chunk-Y4J44CKF.js.map
|