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

Update UDP nodes for node.done

This commit is contained in:
Nick O'Leary 2019-08-15 10:20:54 +01:00
parent cd529d53ae
commit 944b81b71c
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -223,16 +223,19 @@ module.exports = function(RED) {
udpInputPortsInUse[p] = sock; udpInputPortsInUse[p] = sock;
} }
node.on("input", function(msg) { node.on("input", function(msg, nodeSend, nodeDone) {
if (msg.hasOwnProperty("payload")) { if (msg.hasOwnProperty("payload")) {
var add = node.addr || msg.ip || ""; var add = node.addr || msg.ip || "";
var por = node.port || msg.port || 0; var por = node.port || msg.port || 0;
if (add === "") { if (add === "") {
node.warn(RED._("udp.errors.ip-notset")); node.warn(RED._("udp.errors.ip-notset"));
nodeDone();
} else if (por === 0) { } else if (por === 0) {
node.warn(RED._("udp.errors.port-notset")); node.warn(RED._("udp.errors.port-notset"));
nodeDone();
} else if (isNaN(por) || (por < 1) || (por > 65535)) { } else if (isNaN(por) || (por < 1) || (por > 65535)) {
node.warn(RED._("udp.errors.port-invalid")); node.warn(RED._("udp.errors.port-invalid"));
nodeDone();
} else { } else {
var message; var message;
if (node.base64) { if (node.base64) {
@ -247,6 +250,7 @@ module.exports = function(RED) {
node.error("udp : "+err,msg); node.error("udp : "+err,msg);
} }
message = null; message = null;
nodeDone();
}); });
} }
} }