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

One more tidy up for tcp node

This commit is contained in:
Dave Conway-Jones 2015-12-07 22:39:32 +00:00
parent 9baca1772b
commit ef2dc4b9e1

View File

@ -490,7 +490,7 @@ module.exports = function(RED) {
node.connected = false; node.connected = false;
node.status({fill:"red",shape:"ring",text:"common.status.error"}); node.status({fill:"red",shape:"ring",text:"common.status.error"});
node.error(RED._("tcpin.errors.connect-fail"),msg); node.error(RED._("tcpin.errors.connect-fail"),msg);
if (client) { client.end(); } if (client) { client.destroy(); }
}); });
client.on('timeout',function() { client.on('timeout',function() {
@ -499,14 +499,10 @@ module.exports = function(RED) {
node.status({fill:"grey",shape:"dot",text:"tcpin.errors.connect-timeout"}); node.status({fill:"grey",shape:"dot",text:"tcpin.errors.connect-timeout"});
//node.warn(RED._("tcpin.errors.connect-timeout")); //node.warn(RED._("tcpin.errors.connect-timeout"));
if (client) { if (client) {
//client.end(); client.connect(port, host, function() {
//setTimeout(function() { node.connected = true;
client.connect(port, host, function() { node.status({fill:"green",shape:"dot",text:"common.status.connected"});
node.connected = true; });
node.status({fill:"green",shape:"dot",text:"common.status.connected"});
//client.write(msg.payload);
});
//},reconnectTime);
} }
}); });
} }