From 989bcb1a9071d67e7cb165eff4592080bbb7dc02 Mon Sep 17 00:00:00 2001 From: Andreas Assermark Date: Tue, 19 May 2015 11:57:46 +0200 Subject: [PATCH 1/5] Dependencies to bunyan module updated. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f9f49fc..1dcbb18 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "dependencies": { "jison": "0.3", "asn1": "~0.2.2", - "bunyan": "~0.21", + "bunyan": "^1.3.5", "dtrace-provider": "~0.4" }, "devDependencies": { From fc441f1c2a27748194628c358abb5461cac4ea94 Mon Sep 17 00:00:00 2001 From: Andreas Assermark Date: Tue, 19 May 2015 11:59:01 +0200 Subject: [PATCH 2/5] Fixed a problem that caused Agent._add_provider and Agent.addProviders to be undefined. --- lib/agent.js | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/lib/agent.js b/lib/agent.js index 3074bb3..21c19e9 100644 --- a/lib/agent.js +++ b/lib/agent.js @@ -40,6 +40,31 @@ AgentMIBDecor.prototype.instancePossible = function () { return (this._scalar || this._column); }; +function +Agent(options) +{ + var self = this; + + Listener.call(this, options); + + if (typeof (options.dtrace) !== 'object') + throw new TypeError('options.dtrace (object) is required'); + + this._dtrace = options.dtrace; + + Object.keys(AGENT_PROBES).forEach(function (p) { + var args = AGENT_PROBES[p].splice(0); + args.unshift(p); + + self._dtrace.addProbe.apply(self._dtrace, args); + }); + + this._dtrace.enable(); + + this._mib = new MIB(); +} +util.inherits(Agent, Listener); + Agent.prototype._add_provider = function _add_provider(prov) { var self = this; var decor; @@ -84,31 +109,6 @@ Agent.prototype.addProviders = function addProviders(prov) { } }; -function -Agent(options) -{ - var self = this; - - Listener.call(this, options); - - if (typeof (options.dtrace) !== 'object') - throw new TypeError('options.dtrace (object) is required'); - - this._dtrace = options.dtrace; - - Object.keys(AGENT_PROBES).forEach(function (p) { - var args = AGENT_PROBES[p].splice(0); - args.unshift(p); - - self._dtrace.addProbe.apply(self._dtrace, args); - }); - - this._dtrace.enable(); - - this._mib = new MIB(); -} -util.inherits(Agent, Listener); - /* * The provider is expected to provide one of three things for each iteration * requested of it: From 52f917ca580d3d086842e8b6d1d4d89961d06517 Mon Sep 17 00:00:00 2001 From: Andreas Assermark Date: Tue, 19 May 2015 13:28:41 +0200 Subject: [PATCH 3/5] Taking care of bindning errors. --- lib/listener.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/listener.js b/lib/listener.js index 93c1cf6..17d7098 100644 --- a/lib/listener.js +++ b/lib/listener.js @@ -42,6 +42,13 @@ Listener.prototype.bind = function bind(arg, cb) { cb(); }); + conn.on('error', function (err) { + if (cb) + cb(err || new Error('Unknown binding error')); + else + throw err; + }); + conn.bind(arg.port, arg.addr); }; From 23e76262a3eb2a29509ee74f817b34bfa9cc5a58 Mon Sep 17 00:00:00 2001 From: Andreas Assermark Date: Tue, 15 Mar 2016 09:42:42 +0100 Subject: [PATCH 4/5] Update dependencies to support node v4.4.0. --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 1dcbb18..610b164 100644 --- a/package.json +++ b/package.json @@ -15,10 +15,10 @@ "node": ">=0.6.9" }, "dependencies": { - "jison": "0.3", - "asn1": "~0.2.2", - "bunyan": "^1.3.5", - "dtrace-provider": "~0.4" + "jison": "~0.4", + "asn1": "~0.2", + "bunyan": "~1.7", + "dtrace-provider": "~0.6" }, "devDependencies": { "tap": "~0.4" From c68718cab51feb346273fa73098ed07060c7d849 Mon Sep 17 00:00:00 2001 From: Andreas Assermark Date: Tue, 19 Apr 2016 16:47:06 +0200 Subject: [PATCH 5/5] Fixed an error that caused the jison parser to terminate at 'yy.setContent is not a function'. --- lib/protocol/message.js | 61 +++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 33 deletions(-) diff --git a/lib/protocol/message.js b/lib/protocol/message.js index 4d31f28..4de913f 100644 --- a/lib/protocol/message.js +++ b/lib/protocol/message.js @@ -138,41 +138,36 @@ SnmpMessage.prototype.encode = function encode() function ParseContext() { - this.ASN1 = ASN1; - this.pdu = PDU; - this.varbind = varbind; - this.data = data; - this.message = module.exports; - this.content = undefined; -} + var self = { + ASN1: ASN1, + pdu: PDU, + varbind: varbind, + data: data, + message: module.exports, + content: undefined, + }; + + self.setContent = function (content) { + self.content = content; + }; + + self.parseError = function (str, hash) { + throw new MessageParseError(str, hash); + }; + + self.parse = function (raw, src) { + parser.yy = this; -ParseContext.prototype.parse = function parse(raw, src) -{ - /* - * This is vile. Unfortunately, the parser generated by Jison isn't an - * object instance, nor is it anything that can construct one. This - * doesn't really matter because we don't do anything asynchronous - * during parsing, but it's still wrong. - */ - parser.yy = this; - - parser.parse(raw.buf); - if (!this.content) - throw new EmptyMessageError(); - - this.content._setOrigin(raw, src); - return (this.content); -}; + parser.parse(raw.buf); + if (!self.content) + throw new EmptyMessageError(); -ParseContext.prototype.parseError = function parseError(str, hash) -{ - throw new MessageParseError(str, hash); -}; - -ParseContext.prototype.setContent = function setContent(content) -{ - this.content = content; -}; + self.content._setOrigin(raw, src); + return self.content; + }; + + return self; +} function parseMessage(arg)