mqtt 4.3.6 → 4.3.7

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/lib/client.js CHANGED
@@ -1583,7 +1583,18 @@ MqttClient.prototype._handleAck = function (packet) {
1583
1583
  const that = this
1584
1584
  let err
1585
1585
 
1586
- if (!cb || cb === nop) {
1586
+ // Checking `!cb` happens to work, but it's not technically "correct".
1587
+ //
1588
+ // Why? This code assumes that "no callback" is the same as that "we're not
1589
+ // waiting for responses" (puback, pubrec, pubcomp, suback, or unsuback).
1590
+ //
1591
+ // It would be better to check `if (!this.outgoing[messageId])` here, but
1592
+ // there's no reason to change it and risk (another) regression.
1593
+ //
1594
+ // The only reason this code works is becaues code in MqttClient.publish,
1595
+ // MqttClinet.subscribe, and MqttClient.unsubscribe ensures that we will
1596
+ // have a callback even if the user doesn't pass one in.)
1597
+ if (!cb) {
1587
1598
  debug('_handleAck :: Server sent an ack in error. Ignoring.')
1588
1599
  // Server sent an ack in error, ignore it.
1589
1600
  return
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mqtt",
3
3
  "description": "A library for the MQTT protocol",
4
- "version": "4.3.6",
4
+ "version": "4.3.7",
5
5
  "contributors": [
6
6
  "Adam Rudd <adamvrr@gmail.com>",
7
7
  "Matteo Collina <matteo.collina@gmail.com> (https://github.com/mcollina)",