mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Merge branch 'master' into 0.17
This commit is contained in:
commit
7730d0a4f8
@ -213,7 +213,6 @@ RED.sidebar.info = (function() {
|
|||||||
$('<tr class="node-info-subflow-row"><td>'+RED._("sidebar.info.instances")+"</td><td>"+userCount+'</td></tr>').appendTo(tableBody);
|
$('<tr class="node-info-subflow-row"><td>'+RED._("sidebar.info.instances")+"</td><td>"+userCount+'</td></tr>').appendTo(tableBody);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$(table).appendTo(nodeSection.content);
|
$(table).appendTo(nodeSection.content);
|
||||||
|
|
||||||
var infoText = "";
|
var infoText = "";
|
||||||
|
@ -63,7 +63,7 @@ module.exports = function(RED) {
|
|||||||
if ((node.datatype) === "utf8" && node.newline !== "") {
|
if ((node.datatype) === "utf8" && node.newline !== "") {
|
||||||
buffer = buffer+data;
|
buffer = buffer+data;
|
||||||
var parts = buffer.split(node.newline);
|
var parts = buffer.split(node.newline);
|
||||||
for (var i = 0;i<parts.length-1;i+=1) {
|
for (var i = 0; i<parts.length-1; i+=1) {
|
||||||
msg = {topic:node.topic, payload:parts[i]};
|
msg = {topic:node.topic, payload:parts[i]};
|
||||||
msg._session = {type:"tcp",id:id};
|
msg._session = {type:"tcp",id:id};
|
||||||
node.send(msg);
|
node.send(msg);
|
||||||
@ -143,13 +143,13 @@ module.exports = function(RED) {
|
|||||||
buffer = buffer+data;
|
buffer = buffer+data;
|
||||||
var parts = buffer.split(node.newline);
|
var parts = buffer.split(node.newline);
|
||||||
for (var i = 0; i<parts.length-1; i+=1) {
|
for (var i = 0; i<parts.length-1; i+=1) {
|
||||||
msg = {topic:node.topic, payload:parts[i],ip:socket.remoteAddress,port:socket.remotePort};
|
msg = {topic:node.topic, payload:parts[i], ip:socket.remoteAddress, port:socket.remotePort};
|
||||||
msg._session = {type:"tcp",id:id};
|
msg._session = {type:"tcp",id:id};
|
||||||
node.send(msg);
|
node.send(msg);
|
||||||
}
|
}
|
||||||
buffer = parts[parts.length-1];
|
buffer = parts[parts.length-1];
|
||||||
} else {
|
} else {
|
||||||
msg = {topic:node.topic, payload:data};
|
msg = {topic:node.topic, payload:data, ip:socket.remoteAddress, port:socket.remotePort};
|
||||||
msg._session = {type:"tcp",id:id};
|
msg._session = {type:"tcp",id:id};
|
||||||
node.send(msg);
|
node.send(msg);
|
||||||
}
|
}
|
||||||
@ -164,7 +164,7 @@ module.exports = function(RED) {
|
|||||||
socket.on('end', function() {
|
socket.on('end', function() {
|
||||||
if (!node.stream || (node.datatype === "utf8" && node.newline !== "")) {
|
if (!node.stream || (node.datatype === "utf8" && node.newline !== "")) {
|
||||||
if (buffer.length > 0) {
|
if (buffer.length > 0) {
|
||||||
var msg = {topic:node.topic, payload:buffer};
|
var msg = {topic:node.topic, payload:buffer, ip:socket.remoteAddress, port:socket.remotePort};
|
||||||
msg._session = {type:"tcp",id:id};
|
msg._session = {type:"tcp",id:id};
|
||||||
node.send(msg);
|
node.send(msg);
|
||||||
}
|
}
|
||||||
@ -209,7 +209,6 @@ module.exports = function(RED) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
RED.nodes.registerType("tcp in",TcpIn);
|
RED.nodes.registerType("tcp in",TcpIn);
|
||||||
|
|
||||||
@ -461,6 +460,7 @@ module.exports = function(RED) {
|
|||||||
clients[connection_id].client.on('data', function(data) {
|
clients[connection_id].client.on('data', function(data) {
|
||||||
if (node.out === "sit") { // if we are staying connected just send the buffer
|
if (node.out === "sit") { // if we are staying connected just send the buffer
|
||||||
if (clients[connection_id]) {
|
if (clients[connection_id]) {
|
||||||
|
if (!clients[connection_id].hasOwnProperty("msg")) { clients[connection_id].msg = {}; }
|
||||||
clients[connection_id].msg.payload = data;
|
clients[connection_id].msg.payload = data;
|
||||||
node.send(RED.util.cloneMessage(clients[connection_id].msg));
|
node.send(RED.util.cloneMessage(clients[connection_id].msg));
|
||||||
}
|
}
|
||||||
@ -579,14 +579,16 @@ module.exports = function(RED) {
|
|||||||
|
|
||||||
clients[connection_id].client.on('timeout',function() {
|
clients[connection_id].client.on('timeout',function() {
|
||||||
//console.log("TIMEOUT");
|
//console.log("TIMEOUT");
|
||||||
clients[connection_id].connected = false;
|
if (clients[connection_id]) {
|
||||||
node.status({fill:"grey",shape:"dot",text:"tcpin.errors.connect-timeout"});
|
clients[connection_id].connected = false;
|
||||||
//node.warn(RED._("tcpin.errors.connect-timeout"));
|
node.status({fill:"grey",shape:"dot",text:"tcpin.errors.connect-timeout"});
|
||||||
if (clients[connection_id] && clients[connection_id].client) {
|
//node.warn(RED._("tcpin.errors.connect-timeout"));
|
||||||
clients[connection_id].client.connect(port, host, function() {
|
if (clients[connection_id].client) {
|
||||||
clients[connection_id].connected = true;
|
clients[connection_id].client.connect(port, host, function() {
|
||||||
node.status({fill:"green",shape:"dot",text:"common.status.connected"});
|
clients[connection_id].connected = true;
|
||||||
});
|
node.status({fill:"green",shape:"dot",text:"common.status.connected"});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -600,7 +602,9 @@ module.exports = function(RED) {
|
|||||||
this.on("close", function(done) {
|
this.on("close", function(done) {
|
||||||
node.done = done;
|
node.done = done;
|
||||||
for (var client in clients) {
|
for (var client in clients) {
|
||||||
clients[client].client.destroy();
|
if (clients.hasOwnProperty("client")) {
|
||||||
|
clients[client].client.destroy();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
node.status({});
|
node.status({});
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ Node.prototype.updateWires = function(wires) {
|
|||||||
}
|
}
|
||||||
Node.prototype.context = function() {
|
Node.prototype.context = function() {
|
||||||
if (!this._context) {
|
if (!this._context) {
|
||||||
this._context = context.get(this._alias||this.id,this.z);
|
this._context = context.get(this._alias||this.id,this.z);
|
||||||
}
|
}
|
||||||
return this._context;
|
return this._context;
|
||||||
}
|
}
|
||||||
|
@ -47,9 +47,9 @@ function getContext(localId,flowId) {
|
|||||||
var newContext = createContext(contextId);
|
var newContext = createContext(contextId);
|
||||||
if (flowId) {
|
if (flowId) {
|
||||||
newContext.flow = getContext(flowId);
|
newContext.flow = getContext(flowId);
|
||||||
if (globalContext) {
|
}
|
||||||
newContext.global = globalContext;
|
if (globalContext) {
|
||||||
}
|
newContext.global = globalContext;
|
||||||
}
|
}
|
||||||
contexts[contextId] = newContext;
|
contexts[contextId] = newContext;
|
||||||
return newContext;
|
return newContext;
|
||||||
|
Loading…
Reference in New Issue
Block a user