Comparing version 1.0.1 to 1.1.0
{ | ||
"name": "riemann", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "node.js client for Riemann, supports hybrid UDP/TCP connections.", | ||
@@ -21,3 +21,3 @@ "author": { | ||
"dependencies": { | ||
"node-protobuf": "^1.2.9" | ||
"node-protobuf": "^1.4.3" | ||
}, | ||
@@ -24,0 +24,0 @@ "devDependencies": { |
@@ -105,4 +105,5 @@ # [Riemann](http://aphyr.github.com/riemann/) Node.js Client | ||
- install the developer dependencies using `npm install --dev` | ||
- install the dependencies using `npm install`. | ||
- install Riemann using the [quickstart instructions](http://riemann.io/quickstart.html). A running Riemann server is required to run the tests. | ||
- please add tests. I'm using [Mocha](http://visionmedia.github.com/mocha/) as a test runner, you can run the tests using `npm test` | ||
- please check your syntax with the included jshint configuration using `npm run-script lint`. It shouldn't report any errors. |
@@ -88,2 +88,5 @@ var assert = require('assert'); | ||
// proxy the UDP sent event. | ||
this.udp.socket.on('sent', function() { self.emit('sent'); }); | ||
// proxy errors from TCP and UDP | ||
@@ -90,0 +93,0 @@ this.tcp.socket.on('error', function(error) { self.emit('error', error); }); |
@@ -15,3 +15,15 @@ var assert = require('assert'); | ||
assert(Buffer.isBuffer(payload)); | ||
this.socket.send(payload, 0, payload.length, this.options.port, this.options.host); | ||
var self = this; | ||
function callback (err) { | ||
if (err) { | ||
self.socket.emit('error',err); | ||
} else { | ||
self.socket.emit('sent'); | ||
} | ||
} | ||
// callback usage lets us be aware not only of erroneous but successfull invocations as well | ||
this.socket.send(payload, 0, payload.length, this.options.port, this.options.host, callback); | ||
}; | ||
@@ -31,3 +43,3 @@ | ||
this._lenBufferOffset = 0; | ||
this._lenBuffer = new Buffer(4); | ||
this._lenBuffer = Buffer.alloc(4); | ||
this._payloadBuffer = null; | ||
@@ -57,3 +69,3 @@ this._payloadOffset = 0; | ||
chunk.copy(self._lenBuffer, self._lenBufferOffset, 0, chunkOffset); | ||
self._payloadBuffer = new Buffer(_getResponseLength(self._lenBuffer)); | ||
self._payloadBuffer = Buffer.alloc(_getResponseLength(self._lenBuffer)); | ||
self._socketState = 2; | ||
@@ -90,3 +102,3 @@ self._lenBufferOffset = 0; // re-init | ||
var len = payload.length; | ||
var packet = new Buffer(len + 4); | ||
var packet = Buffer.alloc(len + 4); | ||
packet[0] = len >>> 24 & 0xFF; | ||
@@ -93,0 +105,0 @@ packet[1] = len >>> 16 & 0xFF; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15744
249
109
11
Updatednode-protobuf@^1.4.3