asyx 0.5.4 → 0.5.5

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/README.md CHANGED
@@ -168,6 +168,8 @@ asyx tunnel --minecraft [--port <n>] [--name <alias>]
168
168
 
169
169
  ## What's new in 0.5.x
170
170
 
171
+ **Reconnect after a DNS blip (0.5.5)** — if the network drops before the MQTT TLS handshake, the CLI stays up and uses the reconnect it already scheduled.
172
+
171
173
  **Tunnel-only CLI (0.5.0)** — npm ships tunnel commands only: `setup`, `mqtt`, and `tunnel`. Focused on secure localhost exposure (HTTP, TCP, UDP). Docs at https://www.asyx.ai/docs
172
174
 
173
175
  **Reliable global install (0.5.2)** — `asyx setup` uses Node's built-in Web Crypto. `npm install -g asyx` works on Node 18+ without module-resolution errors.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asyx",
3
- "version": "0.5.4",
3
+ "version": "0.5.5",
4
4
  "description": "Asyx tunnel CLI — secure localhost exposure (HTTP, TCP, UDP)",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -62,6 +62,7 @@ export class MqttControlPlaneClient {
62
62
 
63
63
  // State tracking
64
64
  this.client = null;
65
+ this.forceClosing = null;
65
66
  this.shuttingDown = false;
66
67
  this.mqttOnline = false;
67
68
  this.hardErrorCount = 0;
@@ -427,6 +428,11 @@ export class MqttControlPlaneClient {
427
428
  };
428
429
 
429
430
  const onError = (err) => {
431
+ // A pre-TLS failure can be emitted twice. The first emit force-closes
432
+ // this client; ignore that client afterwards so the second emit cannot
433
+ // throw or schedule another reconnect.
434
+ if (this.forceClosing === client || this.client !== client) return;
435
+
430
436
  lastError = err; // Store error for diagnostics
431
437
 
432
438
  // Try to extract more details from the client's internal state
@@ -812,13 +818,17 @@ export class MqttControlPlaneClient {
812
818
  */
813
819
  forceCloseClient() {
814
820
  if (!this.client) return;
821
+ const client = this.client;
822
+ this.forceClosing = client;
815
823
  try {
816
- this.client.end(true);
824
+ client.removeAllListeners();
825
+ client.on('error', () => {});
826
+ client.end(true);
817
827
  } catch {
818
828
  // ignore
819
829
  }
820
- this.client.removeAllListeners();
821
830
  this.client = null;
831
+ this.forceClosing = null;
822
832
  }
823
833
 
824
834
  /**