diff --git a/aedes.js b/aedes.js index c02d2898..ff28e775 100644 --- a/aedes.js +++ b/aedes.js @@ -168,7 +168,13 @@ function Aedes (opts) { const clientId = packet.payload.toString() if (that.clients[clientId] && serverId !== that.id) { - that.clients[clientId].close(done) + if (that.clients[clientId].closed) { + // remove the client from the list if it is already closed + delete that.clients[clientId] + done() + } else { + that.clients[clientId].close(done) + } } else { done() } diff --git a/package.json b/package.json index 50b19bc5..bd552956 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aedes", - "version": "0.50.1", + "version": "0.50.2", "description": "Stream-based MQTT broker", "main": "aedes.js", "types": "aedes.d.ts",