From 10ceed30c6e37bc06ae01d00aeec04c55117e4ce Mon Sep 17 00:00:00 2001
From: Thiago Bustamante
Date: Fri, 3 Nov 2017 11:34:41 -0200
Subject: [PATCH 1/4] Fix #1456
When importing new nodes, it is necessary to check the 'exclusive' flag
---
editor/js/nodes.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/editor/js/nodes.js b/editor/js/nodes.js
index 2cd2f62fc..0c1f0590a 100644
--- a/editor/js/nodes.js
+++ b/editor/js/nodes.js
@@ -872,7 +872,7 @@ RED.nodes = (function() {
}
- if (!existingConfigNode) { //} || !compareNodes(existingConfigNode,n,true) || existingConfigNode._def.exclusive || existingConfigNode.z !== n.z) {
+ if (!existingConfigNode || existingConfigNode._def.exclusive) { //} || !compareNodes(existingConfigNode,n,true) || existingConfigNode.z !== n.z) {
configNode = {id:n.id, z:n.z, type:n.type, users:[], _config:{}};
for (d in def.defaults) {
if (def.defaults.hasOwnProperty(d)) {
From 6696b6661a9f52fb860703e8e406468bf1522790 Mon Sep 17 00:00:00 2001
From: Simon Hailes
Date: Wed, 20 Dec 2017 16:04:32 +0000
Subject: [PATCH 2/4] When creating 'redserver' for a node, use runtime.server
rather than runtime.adminApi.server, and fill runtime.server at startup with
the valid http server regardless of adminApi being available. This resolves
websockets not working when the adminApi (httpAdminRoot) is disabled in
settings.
---
red/red.js | 10 +++++++++-
red/runtime/nodes/registry/loader.js | 2 +-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/red/red.js b/red/red.js
index 5ca42050a..7aec5750a 100644
--- a/red/red.js
+++ b/red/red.js
@@ -69,13 +69,21 @@ module.exports = {
runtime.init(userSettings,api);
api.init(httpServer,runtime);
apiEnabled = true;
+ server = runtime.adminApi.server;
+ runtime.server = runtime.adminApi.server;
} else {
runtime.init(userSettings);
apiEnabled = false;
+ if (httpServer){
+ server = httpServer;
+ runtime.server = httpServer;
+ } else {
+ server = runtime.adminApi.server;
+ runtime.server = runtime.adminApi.server; // useless at this point, but at least harmless.
+ }
}
adminApp = runtime.adminApi.adminApp;
nodeApp = runtime.nodeApp;
- server = runtime.adminApi.server;
return;
},
start: function() {
diff --git a/red/runtime/nodes/registry/loader.js b/red/runtime/nodes/registry/loader.js
index 817b18668..805821a6d 100644
--- a/red/runtime/nodes/registry/loader.js
+++ b/red/runtime/nodes/registry/loader.js
@@ -84,7 +84,7 @@ function createNodeApi(node) {
red.auth = runtime.adminApi.auth;
red.httpAdmin = runtime.adminApi.adminApp;
red.httpNode = runtime.nodeApp;
- red.server = runtime.adminApi.server;
+ red.server = runtime.server;
} else {
//TODO: runtime.adminApi is always stubbed if not enabled, so this block
// is unused - but may be needed for the unit tests
From a3640bd9bf7e8676537e7853e81ed4d0846a9a27 Mon Sep 17 00:00:00 2001
From: Dave Conway-Jones
Date: Thu, 11 Jan 2018 22:03:59 +0000
Subject: [PATCH 3/4] tag UDP ports in use properly so they get closed
correctly (#1508)
* tag ports in use properly so they get closed correctly
to close #1470
* redo test for udp port in use
* check port in use correctly on close
---
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 afebc6062..fac5135cf 100644
--- a/nodes/core/io/32-udp.js
+++ b/nodes/core/io/32-udp.js
@@ -125,8 +125,8 @@ module.exports = function(RED) {
if (process.version.indexOf("v0.10") === 0) { opts = node.ipv; }
var sock;
- if (udpInputPortsInUse[this.outport]) {
- sock = udpInputPortsInUse[this.outport];
+ if (udpInputPortsInUse[this.outport || this.port]) {
+ sock = udpInputPortsInUse[this.outport || this.port];
}
else {
sock = dgram.createSocket(opts); // default to udp4
@@ -136,7 +136,7 @@ module.exports = function(RED) {
// prevent it going to the global error handler and shutting node-red
// down.
});
- udpInputPortsInUse[this.outport] = sock;
+ udpInputPortsInUse[this.outport || this.port] = sock;
}
if (node.multicast != "false") {
@@ -161,7 +161,7 @@ module.exports = function(RED) {
node.log(RED._("udp.status.bc-ready",{outport:node.outport,host:node.addr,port:node.port}));
}
});
- } else if ((node.outport !== "") && (!udpInputPortsInUse[this.outport])) {
+ } else if ((node.outport !== "") && (!udpInputPortsInUse[node.outport])) {
sock.bind(node.outport);
node.log(RED._("udp.status.ready",{outport:node.outport,host:node.addr,port:node.port}));
} else {
@@ -198,8 +198,8 @@ module.exports = function(RED) {
});
node.on("close", function() {
- if (udpInputPortsInUse.hasOwnProperty(node.outport)) {
- delete udpInputPortsInUse[node.outport];
+ if (udpInputPortsInUse.hasOwnProperty(node.outport || node.port)) {
+ delete udpInputPortsInUse[node.outport || node.port];
}
try {
sock.close();
From 71fee0025da24dca6b370984045f68549a187561 Mon Sep 17 00:00:00 2001
From: Colin Law
Date: Sat, 13 Jan 2018 15:33:15 +0000
Subject: [PATCH 4/4] Add description of Timeout field in exec node info tab
(#1550)
---
nodes/core/core/75-exec.html | 1 +
1 file changed, 1 insertion(+)
diff --git a/nodes/core/core/75-exec.html b/nodes/core/core/75-exec.html
index 713cd9699..8d9d167f8 100644
--- a/nodes/core/core/75-exec.html
+++ b/nodes/core/core/75-exec.html
@@ -115,6 +115,7 @@
the type of signal to be sent, for example, SIGINT
, SIGQUIT
or SIGHUP
.
Defaults to SIGTERM
if set to an empty string.
If the node has more than one process running then msg.pid
must also be set with the value of the PID to be killed.
+ If a value is provided in the Timeout
field then, if the process has not completed when the specified number of seconds has elapsed, the process will be killed automatically
Tip: if running a Python app you may need to use the -u
parameter to stop the output being buffered.