Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mqttjs/MQTT.js
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v4.3.4
Choose a base ref
...
head repository: mqttjs/MQTT.js
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v4.3.5
Choose a head ref
  • 3 commits
  • 4 files changed
  • 3 contributors

Commits on Jan 7, 2022

  1. chore(README): add announcements (#1399)

    update readme for announcements
    Yoseph Maguire authored Jan 7, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    4604b10 View commit details

Commits on Jan 18, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    7ec4b8f View commit details

Commits on Feb 7, 2022

  1. release: 4.3.5 (#1414)

    YoDaMa authored Feb 7, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    9eb4c79 View commit details
Showing with 18 additions and 4 deletions.
  1. +4 −0 CHANGELOG.md
  2. +8 −0 README.md
  3. +5 −3 lib/client.js
  4. +1 −1 package.json
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release History

## 4.3.5

fix(drain-leak): fix regression introduced in #1301 (#1401)

## 4.3.4

fix(dependency): migrate LruMap from collections to lru-cache (#1396)
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -6,6 +6,14 @@
MQTT.js is a client library for the [MQTT](http://mqtt.org/) protocol, written
in JavaScript for node.js and the browser.

| :warning: WARNING |
|:---------------------------|
| our default branch has been moved from *master* to *main* |

| :boom: MQTT.js vNext |
|:---------------------------|
| Want to contribute to the next generation of **MQTT.js**? Join the discussion [here](https://github.com/mqttjs/MQTT.js/discussions/1324). |

## Table of Contents
* [__MQTT.js vNext__](#vnext)
* [Upgrade notes](#notes)
8 changes: 5 additions & 3 deletions lib/client.js
Original file line number Diff line number Diff line change
@@ -175,7 +175,7 @@ function sendPacket (client, packet, cb) {
debug('sendPacket :: writing to stream')
const result = mqttPacket.writeToStream(packet, client.stream, client.options)
debug('sendPacket :: writeToStream result %s', result)
if (!result && cb) {
if (!result && cb && cb !== nop) {
debug('sendPacket :: handle events on `drain` once through callback.')
client.stream.once('drain', cb)
} else if (cb) {
@@ -190,6 +190,8 @@ function flush (queue) {
Object.keys(queue).forEach(function (messageId) {
if (typeof queue[messageId].cb === 'function') {
queue[messageId].cb(new Error('Connection closed'))
// This is suspicious. Why do we only delete this if we have a callbck?
// If this is by-design, then adding no as callback would cause this to get deleted unintentionally.
delete queue[messageId]
}
})
@@ -569,7 +571,7 @@ MqttClient.prototype._handlePacket = function (packet, done) {

MqttClient.prototype._checkDisconnecting = function (callback) {
if (this.disconnecting) {
if (callback) {
if (callback && callback !== nop) {
callback(new Error('client disconnecting'))
} else {
this.emit('error', new Error('client disconnecting'))
@@ -1581,7 +1583,7 @@ MqttClient.prototype._handleAck = function (packet) {
const that = this
let err

if (!cb) {
if (!cb || cb === nop) {
debug('_handleAck :: Server sent an ack in error. Ignoring.')
// Server sent an ack in error, ignore it.
return
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mqtt",
"description": "A library for the MQTT protocol",
"version": "4.3.4",
"version": "4.3.5",
"contributors": [
"Adam Rudd <adamvrr@gmail.com>",
"Matteo Collina <matteo.collina@gmail.com> (https://github.com/mcollina)",