diff --git a/io/snmp/package.json b/io/snmp/package.json index 8bb38f20..3f19cb1b 100644 --- a/io/snmp/package.json +++ b/io/snmp/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-snmp", - "version" : "1.0.2", + "version" : "1.0.3", "description" : "A Node-RED node that gets and sets SNMP oid values. Supports v1, v2c and v3", "dependencies" : { "net-snmp" : "^3.8.2" @@ -26,6 +26,7 @@ { "name": "Mika Karaila" }, { "name": "Bryan Malyn" }, { "name": "Steve-Mcl" }, - { "name": "Andres" } + { "name": "Andres" }, + { "name": "@echobops" } ] } diff --git a/io/snmp/snmp.js b/io/snmp/snmp.js index 8c7ca99d..a50687bc 100644 --- a/io/snmp/snmp.js +++ b/io/snmp/snmp.js @@ -392,6 +392,7 @@ module.exports = function (RED) { node.on("input", function (msg) { const oids = node.oids || msg.oid; const { host, sessionid, user, options } = prepareSnmpOptions(node, msg); + const response = []; function feedCb(varbinds) { for (let i = 0; i < varbinds.length; i++) { if (SNMP.isVarbindError(varbinds[i])) { @@ -407,10 +408,6 @@ module.exports = function (RED) { sess.on("error", function (err) { node.error(err, msg); }) - //move response array & feedCb to inside `node.on("input",` to avoid subsequent - // calls overwriting results from previous operations (each call gets own result/response) - const response = []; - sess.subtree(msg.oid, maxRepetitions, feedCb, function (error) { if (error) { node.error(error.toString(), msg);