@cryptotaxi247 / netdata-1 / commits / 26c69b7ec

updated net-snmp.js to latest version

Costa Tsaousis (ktsaou) committed Jun 11, 2018 at 20:50 UTC 26c69b7ec1ad670df9b9400ee034efd61c13e283
1 file changed +11 -4
node.d/node_modules/net-snmp.js
+11 -4
@@ -578,6 +578,10 @@ var Session = function (target, community, options) {
578 ? parseInt(options.sourcePort)
579 : undefined;
580
581 + this.idBitsSize = (options && options.idBitsSize)
582 + ? parseInt(options.idBitsSize)
583 + : 32;
584 +
585 this.reqs = {};
586 this.reqCount = 0;
587
@@ -609,8 +613,11 @@ Session.prototype.cancelRequests = function (error) {
613 }
614 };
615
612 -function _generateId () {
613 - return Math.floor (Math.random () + Math.random () * 10000000)
616 +function _generateId (bitSize) {
617 + if (bitSize === 16) {
618 + return Math.floor(Math.random() * 10000) % 65535;
619 + }
620 + return Math.floor(Math.random() * 100000000) % 4294967295;
621 }
622
623 Session.prototype.get = function (oids, responseCb) {
@@ -1044,7 +1051,7 @@ Session.prototype.simpleGet = function (pduClass, feedCb, varbinds,
1051 var req = {};
1052
1053 try {
1047 - var id = _generateId ();
1054 + var id = _generateId (this.idBitsSize);
1055 var pdu = new pduClass (id, varbinds, options);
1056 var message = new RequestMessage (this.version, this.community, pdu);
1057
@@ -1290,7 +1297,7 @@ Session.prototype.trap = function () {
1297 pduVarbinds.push (varbind);
1298 }
1299
1293 - var id = _generateId ();
1300 + var id = _generateId (this.idBitsSize);
1301
1302 if (this.version == Version2c) {
1303 if (typeof typeOrOid != "string")