From 82d9a02d9249bc421ad7d9ff86fc131e6cc07391 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Fri, 23 Jun 2017 16:20:28 +0100 Subject: [PATCH] Move udp sock error listener to only be instantiated once. --- nodes/core/io/32-udp.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/nodes/core/io/32-udp.js b/nodes/core/io/32-udp.js index 47bb5dcd7..849a7e270 100644 --- a/nodes/core/io/32-udp.js +++ b/nodes/core/io/32-udp.js @@ -130,15 +130,15 @@ module.exports = function(RED) { } else { sock = dgram.createSocket(opts); // default to udp4 + 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. + }); udpInputPortsInUse[this.outport] = sock; } - 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...