tidy up Ping node close

This commit is contained in:
Dave Conway-Jones 2015-12-26 19:21:24 +00:00
parent 617e6809b5
commit ce677d221b
2 changed files with 4 additions and 3 deletions

View File

@ -49,12 +49,13 @@ module.exports = function(RED) {
} }
var msg = { payload:false, topic:node.host }; var msg = { payload:false, topic:node.host };
if (code === 0) { msg = { payload:res, topic:node.host }; } if (code === 0) { msg = { payload:res, topic:node.host }; }
node.send(msg); try { node.send(msg); }
catch(e) {}
}); });
}, node.timer); }, node.timer);
this.on("close", function() { this.on("close", function() {
clearInterval(this.tout); if (this.tout) { clearInterval(this.tout); }
}); });
} }
RED.nodes.registerType("ping",PingNode); RED.nodes.registerType("ping",PingNode);

View File

@ -1,6 +1,6 @@
{ {
"name" : "node-red-node-ping", "name" : "node-red-node-ping",
"version" : "0.0.6", "version" : "0.0.7",
"description" : "A Node-RED node to ping a remote server, for use as a keep-alive check.", "description" : "A Node-RED node to ping a remote server, for use as a keep-alive check.",
"dependencies" : { "dependencies" : {
}, },