From fe0d4f08f35e06412cc83f68a41c2f99fe07117b Mon Sep 17 00:00:00 2001 From: Vladimir Dronnikov Date: Wed, 25 Dec 2019 06:21:55 +0300 Subject: [PATCH] Allow to know particular session from status node The rationale is to keep own list of active sessions. As a workaround for https://discourse.nodered.org/t/tcp-connection-pool-better-separation/19432 TIA --- .../node_modules/@node-red/nodes/core/network/31-tcpin.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/node_modules/@node-red/nodes/core/network/31-tcpin.js b/packages/node_modules/@node-red/nodes/core/network/31-tcpin.js index e52e9c382..655e72c1e 100644 --- a/packages/node_modules/@node-red/nodes/core/network/31-tcpin.js +++ b/packages/node_modules/@node-red/nodes/core/network/31-tcpin.js @@ -74,7 +74,7 @@ module.exports = function(RED) { buffer = (node.datatype == 'buffer') ? Buffer.alloc(0) : ""; node.connected = true; node.log(RED._("tcpin.status.connected",{host:node.host,port:node.port})); - node.status({fill:"green",shape:"dot",text:"common.status.connected"}); + node.status({fill:"green",shape:"dot",text:"common.status.connected",_session:{type:"tcp",id:id}}); }); client.setKeepAlive(true,120000); connectionPool[id] = client; @@ -121,7 +121,7 @@ module.exports = function(RED) { client.on('close', function() { delete connectionPool[id]; node.connected = false; - node.status({fill:"red",shape:"ring",text:"common.status.disconnected"}); + node.status({fill:"red",shape:"ring",text:"common.status.disconnected",_session:{type:"tcp",id:id}}); if (!node.closing) { if (end) { // if we were asked to close then try to reconnect once very quick. end = false;