From 97a1f0b0057e16d8359d7d80f659032eb84b8b1b Mon Sep 17 00:00:00 2001 From: "gianluca.casagrande" Date: Mon, 8 Jan 2024 17:59:55 +0100 Subject: [PATCH] delete already closed client on closeSameClients --- aedes.js | 8 +++++++- package.json | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) 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",