mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Always clone messages to ensure no cross-pollution
Part of #85 A function that returns the same message to multiple outputs, where each output is wired to at most one node was not having its messages cloned due to the change I made in #85 to be slightly more efficient. By returning the same message to each output, cross pollution was possible.
This commit is contained in:
parent
0bc0dc3a2b
commit
0507578c98
22
red/nodes.js
22
red/nodes.js
@ -155,16 +155,16 @@ Node.prototype.send = function(msg) {
|
|||||||
if (!util.isArray(msg[i])) {
|
if (!util.isArray(msg[i])) {
|
||||||
msgs = [msg[i]];
|
msgs = [msg[i]];
|
||||||
}
|
}
|
||||||
if (wires.length == 1) {
|
//if (wires.length == 1) {
|
||||||
// Single recipient, don't need to clone the message
|
// // Single recipient, don't need to clone the message
|
||||||
var node = registry.get(wires[0]);
|
// var node = registry.get(wires[0]);
|
||||||
if (node) {
|
// if (node) {
|
||||||
for (var k in msgs) {
|
// for (var k in msgs) {
|
||||||
var mm = msgs[k];
|
// var mm = msgs[k];
|
||||||
node.receive(mm);
|
// node.receive(mm);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
} else {
|
//} else {
|
||||||
// Multiple recipients, must send message copies
|
// Multiple recipients, must send message copies
|
||||||
for (var j in wires) {
|
for (var j in wires) {
|
||||||
var node = registry.get(wires[j]);
|
var node = registry.get(wires[j]);
|
||||||
@ -184,7 +184,7 @@ Node.prototype.send = function(msg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user