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

Add async error handler to UDP out node

Fixes #629
This commit is contained in:
Nick O'Leary 2015-04-24 11:17:18 +01:00
parent 0583c60837
commit c016b102eb

View File

@ -103,7 +103,13 @@ module.exports = function(RED) {
var node = this; var node = this;
var sock = dgram.createSocket(node.ipv); // default to ipv4 var sock = dgram.createSocket(node.ipv); // default to ipv4
sock.on("error", function(err) {
// Any async error will also get reported in the sock.send call.
// This handler is needed to ensure the error marked as handled to
// prevent it going to the global error handler and shutting node-red
// down.
});
if (node.multicast != "false") { if (node.multicast != "false") {
if (node.outport == "") { node.outport = node.port; } if (node.outport == "") { node.outport = node.port; }
sock.bind(node.outport, function() { // have to bind before you can enable broadcast... sock.bind(node.outport, function() { // have to bind before you can enable broadcast...