Skip to content

Commit

Permalink
rm -rf udp (#197)
Browse files Browse the repository at this point in the history
* rm -rf udp

This has been gone for years
  • Loading branch information
mattrobenolt authored and LewisJEllis committed Sep 12, 2016
1 parent 50ce369 commit 29b14f8
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 51 deletions.
22 changes: 1 addition & 21 deletions lib/transports.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,28 +63,8 @@ function HTTPSTransport(options) {
}
util.inherits(HTTPSTransport, HTTPTransport);

var dgram = require('dgram');

function UDPTransport() {
this.defaultPort = 12345;
}
util.inherits(UDPTransport, Transport);
UDPTransport.prototype.send = function(client, message, headers, ident) {
message = new Buffer(headers['X-Sentry-Auth'] + '\n\n' + message);

var udp = dgram.createSocket('udp4');
udp.send(message, 0, message.length, client.dsn.port || this.defaultPort, client.dsn.host, function(e, bytes) {
if (e) {
return client.emit('error', e);
}
client.emit('logged', ident);
udp.close();
});
};

module.exports.http = new HTTPTransport();
module.exports.https = new HTTPSTransport();
module.exports.udp = new UDPTransport();
module.exports.Transport = Transport;
module.exports.HTTPTransport = HTTPTransport;
module.exports.HTTPSTransport = HTTPSTransport;
module.exports.HTTPSTransport = HTTPSTransport;
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"istanbul": "^0.4.3",
"koa": "*",
"mocha": "*",
"mock-udp": "*",
"nock": "~0.28.2",
"should": "~3.3.1"
}
Expand Down
17 changes: 2 additions & 15 deletions test/raven.client.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

var raven = require('../'),
nock = require('nock'),
mockudp = require('mock-udp'),
zlib = require('zlib');

var dsn = 'https://public:private@app.getsentry.com/269';
Expand Down Expand Up @@ -249,18 +248,6 @@ describe('raven.Client', function() {
client.captureError(new Error('wtf?'));
});

it('should send an Error to Sentry server over UDP', function(done) {
var scope = mockudp('app.getsentry.com:1234');

var dsn = 'udp://public:private@app.getsentry.com:1234/269';
var client = new raven.Client(dsn);
client.on('logged', function() {
scope.done();
done();
});
client.captureError(new Error('wtf?'));
});

it('shouldn\'t choke on circular references', function(done) {
// See: https://github.com/mattrobenolt/raven-node/pull/46
var old = zlib.deflate;
Expand Down Expand Up @@ -418,15 +405,15 @@ describe('raven.Client', function() {

it('should use a custom transport', function() {
var expected = {
protocol: 'udp',
protocol: 'https',
public_key: 'public',
private_key: 'private',
host: 'app.getsentry.com',
path: '/',
project_id: 269,
port: 443
};
var dsn = 'heka+udp://public:private@app.getsentry.com/269';
var dsn = 'heka+https://public:private@app.getsentry.com/269';
var client = new raven.Client(dsn, {
transport: 'some_heka_instance'
});
Expand Down
14 changes: 0 additions & 14 deletions test/raven.utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,6 @@ describe('raven.utils', function() {
raven.utils.parseDSN('').should.eql(false);
});

it('should parse UDP DSN', function() {
var dsn = raven.utils.parseDSN('udp://8769c40cf49c4cc58b51fa45d8e2d166:296768aa91084e17b5ac02d3ad5bc7e7@mysentry.com:1234/some/other/path/269');
var expected = {
protocol: 'udp',
public_key: '8769c40cf49c4cc58b51fa45d8e2d166',
private_key: '296768aa91084e17b5ac02d3ad5bc7e7',
host: 'mysentry.com',
path: '/some/other/path/',
project_id: 269,
port: 1234
};
dsn.should.eql(expected);
});

it('show throw an Error on invalid transport protocol', function() {
(function() {
raven.utils.parseDSN('noop://8769c40cf49c4cc58b51fa45d8e2d166:296768aa91084e17b5ac02d3ad5bc7e7@mysentry.com:1234/some/other/path/269');
Expand Down

0 comments on commit 29b14f8

Please sign in to comment.