From c016b102ebd90f978fc0d444d40777d5fb77430f Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Fri, 24 Apr 2015 11:17:18 +0100 Subject: [PATCH] Add async error handler to UDP out node Fixes #629 --- nodes/core/io/32-udp.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nodes/core/io/32-udp.js b/nodes/core/io/32-udp.js index f2310b8b3..6c2072142 100644 --- a/nodes/core/io/32-udp.js +++ b/nodes/core/io/32-udp.js @@ -103,7 +103,13 @@ module.exports = function(RED) { var node = this; 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.outport == "") { node.outport = node.port; } sock.bind(node.outport, function() { // have to bind before you can enable broadcast...