1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Close tcp out node more forcibly. (and update status) on redeploy.

This commit is contained in:
Dave Conway-Jones 2015-12-07 17:41:51 +00:00
parent dda90f956d
commit 1280e5bc8b

View File

@ -242,6 +242,8 @@ module.exports = function(RED) {
node.log(RED._("tcpin.errors.error",{error:err.toString()})); node.log(RED._("tcpin.errors.error",{error:err.toString()}));
}); });
client.on('end', function (err) { client.on('end', function (err) {
node.status({});
node.connected = false;
}); });
client.on('close', function() { client.on('close', function() {
node.status({fill:"red",shape:"ring",text:"common.status.disconnected"}); node.status({fill:"red",shape:"ring",text:"common.status.disconnected"});
@ -282,7 +284,7 @@ module.exports = function(RED) {
node.on("close", function(done) { node.on("close", function(done) {
node.done = done; node.done = done;
this.closing = true; this.closing = true;
if (client) { client.end(); } if (client) { client.destroy(); }
clearTimeout(reconnectTimeout); clearTimeout(reconnectTimeout);
if (!node.connected) { done(); } if (!node.connected) { done(); }
}); });