Fix snmp node to clone response before sending

This commit is contained in:
Nick O'Leary 2019-10-05 19:36:20 +01:00
parent aa2965f000
commit 18f42be574
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 6 additions and 4 deletions

View File

@ -1,9 +1,9 @@
{
"name" : "node-red-node-snmp",
"version" : "0.0.21",
"version" : "0.0.22",
"description" : "A Node-RED node that looks for SNMP oids.",
"dependencies" : {
"net-snmp" : "1.1.8"
"net-snmp" : "1.2.4"
},
"repository" : {
"type":"git",

View File

@ -193,7 +193,8 @@ module.exports = function (RED) {
node.error(error.toString(), msg);
}
else {
msg.payload = response;
// Clone the array
msg.payload = response.slice(0);
node.send(msg);
//Clears response
response.length = 0;
@ -243,7 +244,8 @@ module.exports = function (RED) {
node.error(error.toString(), msg);
}
else {
msg.payload = response;
// Clone the array
msg.payload = response.slice(0);
node.send(msg);
//Clears response
response.length = 0;