If not connected, do not try to disconnect

This commit is contained in:
Olivier Verhaegen
2023-04-17 11:19:40 +02:00
committed by GitHub
parent 4cf1216845
commit b2aea4da29

View File

@@ -248,8 +248,8 @@ module.exports = function(RED) {
if (!node.client) {
node.warn("Can't disconnect, connection not initialized.");
callback();
} else if (node.closing) {
// Disconnection already in progress
} else if (node.closing || !node.connected) {
// Disconnection already in progress or not connected
callback();
} else {
waitDisconnect(node.client, 2000).then(() => {