diff --git a/lib/methods/send.js b/lib/methods/send.js index 29a26b9..c8b647d 100644 --- a/lib/methods/send.js +++ b/lib/methods/send.js @@ -28,7 +28,6 @@ send.prototype.send = function(msg) { msg.allocation.sockets[0].send(data, dst.port, dst.address, function(err) { if (err) { - throw new Error(JSON.stringify(dst)); return msg.debug('ERROR', err); } msg.debug('TRACE', 'relaying data from transactionID ' + msg.transactionID + ' to ' + dst); diff --git a/lib/network.js b/lib/network.js index 526f438..c584d65 100644 --- a/lib/network.js +++ b/lib/network.js @@ -36,8 +36,12 @@ network.prototype.start = function() { const src = new Address(rinfo.address, rinfo.port); const transport = new Transport(CONSTANTS.TRANSPORT.PROTOCOL.UDP, src, dst, udpSocket); var msg = new Message(self.server, transport); - if (msg.read(udpMessage)) { - self.server.emit('message', msg); + try { + if (msg.read(udpMessage)) { + self.server.emit('message', msg); + } + } catch(err) { + self.debug('ERROR', err); } });