mqtt 5.5.2 → 5.5.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/mqtt.js CHANGED
@@ -12631,6 +12631,13 @@ var mqtt = (() => {
12631
12631
  }
12632
12632
  });
12633
12633
 
12634
+ // package-json:../../package.json
12635
+ var require_package = __commonJS({
12636
+ "package-json:../../package.json"(exports5, module) {
12637
+ module.exports = { version: "5.5.3" };
12638
+ }
12639
+ });
12640
+
12634
12641
  // build/lib/shared.js
12635
12642
  var require_shared = __commonJS({
12636
12643
  "build/lib/shared.js"(exports5) {
@@ -12639,7 +12646,7 @@ var mqtt = (() => {
12639
12646
  init_process2();
12640
12647
  init_navigator();
12641
12648
  Object.defineProperty(exports5, "__esModule", { value: true });
12642
- exports5.nextTick = exports5.applyMixin = exports5.ErrorWithReasonCode = void 0;
12649
+ exports5.MQTTJS_VERSION = exports5.nextTick = exports5.applyMixin = exports5.ErrorWithReasonCode = void 0;
12643
12650
  var ErrorWithReasonCode = class _ErrorWithReasonCode extends Error {
12644
12651
  constructor(message, code) {
12645
12652
  super(message);
@@ -12673,6 +12680,7 @@ var mqtt = (() => {
12673
12680
  exports5.nextTick = typeof (process_exports === null || process_exports === void 0 ? void 0 : process_exports.nextTick) === "function" ? process_exports.nextTick : (callback) => {
12674
12681
  setTimeout(callback, 0);
12675
12682
  };
12683
+ exports5.MQTTJS_VERSION = require_package().version;
12676
12684
  }
12677
12685
  });
12678
12686
 
@@ -17621,6 +17629,7 @@ var mqtt = (() => {
17621
17629
  var get_timer_1 = __importDefault(require_get_timer());
17622
17630
  var PingTimer = class {
17623
17631
  constructor(keepalive, checkPing, variant) {
17632
+ this.destroyed = false;
17624
17633
  this.keepalive = keepalive * 1e3;
17625
17634
  this.checkPing = checkPing;
17626
17635
  this.timer = (0, get_timer_1.default)(variant);
@@ -17632,13 +17641,21 @@ var mqtt = (() => {
17632
17641
  this.timerId = null;
17633
17642
  }
17634
17643
  }
17644
+ destroy() {
17645
+ this.clear();
17646
+ this.destroyed = true;
17647
+ }
17635
17648
  reschedule() {
17649
+ if (this.destroyed) {
17650
+ return;
17651
+ }
17636
17652
  this.clear();
17637
17653
  this.timerId = this.timer.set(() => {
17638
- this.checkPing();
17639
- if (this.timerId) {
17640
- this.reschedule();
17654
+ if (this.destroyed) {
17655
+ return;
17641
17656
  }
17657
+ this.checkPing();
17658
+ this.reschedule();
17642
17659
  }, this.keepalive);
17643
17660
  }
17644
17661
  };
@@ -17821,9 +17838,9 @@ var mqtt = (() => {
17821
17838
  this.connected = false;
17822
17839
  this.log("close :: clearing connackTimer");
17823
17840
  clearTimeout(this.connackTimer);
17824
- this.log("close :: clearing ping timer");
17841
+ this.log("close :: destroy ping timer");
17825
17842
  if (this.pingTimer) {
17826
- this.pingTimer.clear();
17843
+ this.pingTimer.destroy();
17827
17844
  this.pingTimer = null;
17828
17845
  }
17829
17846
  if (this.topicAliasRecv) {
@@ -18455,8 +18472,8 @@ var mqtt = (() => {
18455
18472
  this._setupReconnect();
18456
18473
  }
18457
18474
  if (this.pingTimer) {
18458
- this.log("_cleanUp :: clearing pingTimer");
18459
- this.pingTimer.clear();
18475
+ this.log("_cleanUp :: destroy pingTimer");
18476
+ this.pingTimer.destroy();
18460
18477
  this.pingTimer = null;
18461
18478
  }
18462
18479
  if (done && !this.connected) {
@@ -18788,7 +18805,7 @@ var mqtt = (() => {
18788
18805
  });
18789
18806
  }
18790
18807
  };
18791
- MqttClient.VERSION = "5.5.2";
18808
+ MqttClient.VERSION = shared_1.MQTTJS_VERSION;
18792
18809
  exports5.default = MqttClient;
18793
18810
  }
18794
18811
  });