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

Merge branch 'master' into 0.18

This commit is contained in:
Nick O'Leary 2018-01-24 23:08:14 +00:00
commit b7a0a9d7c2
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
5 changed files with 18 additions and 9 deletions

View File

@ -896,7 +896,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)) {

View File

@ -115,6 +115,7 @@
the type of signal to be sent, for example, <code>SIGINT</code>, <code>SIGQUIT</code> or <code>SIGHUP</code>.
Defaults to <code>SIGTERM</code> if set to an empty string.</p>
<p>If the node has more than one process running then <code>msg.pid</code> must also be set with the value of the PID to be killed.</p>
<p>If a value is provided in the <code>Timeout</code> field then, if the process has not completed when the specified number of seconds has elapsed, the process will be killed automatically</p>
<p>Tip: if running a Python app you may need to use the <code>-u</code> parameter to stop the output being buffered.</p>
</script>

View File

@ -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();

View File

@ -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() {

View File

@ -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