handle udp send errors

fixes #71

"Port should be > 0 and < 65536"
This commit is contained in:
Feross Aboukhadijeh 2015-05-01 14:20:53 -07:00
parent 1ec4eaa273
commit da0382a435

View File

@ -219,7 +219,12 @@ Server.prototype.onUdpRequest = function (msg, rinfo) {
response.connectionId = params.connectionId
var buf = makeUdpPacket(response)
try {
self.udp.send(buf, 0, buf.length, rinfo.port, rinfo.address)
} catch (err) {
self.emit('warning', err)
}
if (params.action === common.ACTIONS.ANNOUNCE) {
self.emit(common.EVENT_NAMES[params.event], params.addr)