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

Don't accidentally re-use udp port when set to not do so

to close Issue #1764
This commit is contained in:
Dave Conway-Jones 2018-06-15 14:53:02 +01:00
parent 6f5974f875
commit 9d219c163d
No known key found for this signature in database
GPG Key ID: 9E7F9C73F5168CD4

View File

@ -63,7 +63,7 @@ module.exports = function(RED) {
udpInputPortsInUse[this.port] = server;
}
else {
node.warn(RED._("udp.errors.alreadyused",{port:node.port}));
node.log(RED._("udp.errors.alreadyused",{port:node.port}));
server = udpInputPortsInUse[this.port]; // re-use existing
}
@ -172,8 +172,7 @@ module.exports = function(RED) {
if (process.version.indexOf("v0.10") === 0) { opts = node.ipv; }
var sock;
var p = this.port;
if (node.multicast != "false") { p = this.outport||"0"; }
var p = this.outport || this.port || "0";
if (udpInputPortsInUse[p]) {
sock = udpInputPortsInUse[p];
node.log(RED._("udp.status.re-use",{outport:node.outport,host:node.addr,port:node.port}));