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

TCP In: Fix error in timout callback (#1249)

Thanks @natcl
This commit is contained in:
Nathanaël Lécaudé 2017-05-09 17:09:21 -04:00 committed by Dave Conway-Jones
parent 40ad4bdbd8
commit 48958f392f

View File

@ -574,14 +574,16 @@ module.exports = function(RED) {
clients[connection_id].client.on('timeout',function() { clients[connection_id].client.on('timeout',function() {
//console.log("TIMEOUT"); //console.log("TIMEOUT");
clients[connection_id].connected = false; if (clients[connection_id]) {
node.status({fill:"grey",shape:"dot",text:"tcpin.errors.connect-timeout"}); clients[connection_id].connected = false;
//node.warn(RED._("tcpin.errors.connect-timeout")); node.status({fill:"grey",shape:"dot",text:"tcpin.errors.connect-timeout"});
if (clients[connection_id] && clients[connection_id].client) { //node.warn(RED._("tcpin.errors.connect-timeout"));
clients[connection_id].client.connect(port, host, function() { if (clients[connection_id].client) {
clients[connection_id].connected = true; clients[connection_id].client.connect(port, host, function() {
node.status({fill:"green",shape:"dot",text:"common.status.connected"}); clients[connection_id].connected = true;
}); node.status({fill:"green",shape:"dot",text:"common.status.connected"});
});
}
} }
}); });
} }