Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions lib/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,6 @@ function managerRetry(self, id)
} else {
delete(self._requests[id]);
request.cb(1, {});

if (Object.keys(self._requests).length == 0)
self._dgram.close();
}
}

Expand Down Expand Up @@ -196,9 +193,6 @@ function managerRecv(self, buf, peer)
nextBulkGet(self, options, msg.varBindList);
break;
}

if (Object.keys(self._requests).length == 0)
self._dgram.close();
}

/* API */
Expand All @@ -225,10 +219,14 @@ function Manager(options)
function (err) { /* XXX */ });

this._dgram.bind(options.localport);
process.nextTick(function() {
if (Object.keys(self._requests).length == 0)
self._dgram.close();
});
}

Manager.prototype.close = function() {
try {
this._dgram.close();
} catch(e) {
// ?? I don't think we care
}
}

Manager.prototype.get = function (agent, oids, cb, options)
Expand Down
2 changes: 1 addition & 1 deletion lib/messages/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function parseInt(ber, tag)
value = value.shiftLeft(8).add(a);
}

return (fb & 0x80) ? value.mul(-1) : value;
return (fb & 0x80) ? value.subtract(BigInteger.valueOf(Math.pow(2,(buf.length*8)-1))) : value;
}
var intTypes = [ ASN1.Ber.Integer, 65, 66, 67, 70 ];
for (var i = 0; i < intTypes.length; i++) {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"author": "David Gwynne <david@gwynne.id.au>",
"name": "snmp",
"description": "SNMP APIs",
"version": "0.0.2",
"version": "0.0.3",
"repository": {
"type": "git",
"url": "git://github.com/dgwynne/node-snmp.git"
Expand All @@ -12,7 +12,7 @@
"lib": "./lib"
},
"engines": {
"node": ">=0.4"
"node": ">=0.6"
},
"dependencies": {
"asn1": "0.1.11",
Expand Down