diff --git a/lib/udp-tracker.js b/lib/udp-tracker.js index 2b4dc12..b090da8 100644 --- a/lib/udp-tracker.js +++ b/lib/udp-tracker.js @@ -87,6 +87,7 @@ UDPTracker.prototype._request = function (opts) { } socket.removeListener('error', onError) socket.removeListener('message', onSocketMessage) + socket.on('error', noop) // ignore all future errors try { socket.close() } catch (err) {} socket = null } @@ -261,3 +262,5 @@ function toUInt64 (n) { } return Buffer.concat([common.toUInt32(0), common.toUInt32(n)]) } + +function noop () {} diff --git a/lib/websocket-tracker.js b/lib/websocket-tracker.js index 3a88959..570a78a 100644 --- a/lib/websocket-tracker.js +++ b/lib/websocket-tracker.js @@ -87,6 +87,7 @@ WebSocketTracker.prototype.destroy = function () { self._onSocketDataBound = null self._onSocketCloseBound = null + self._socket.on('error', noop) // ignore all future errors try { self._socket.close() } catch (e) {} self._socket = null } @@ -238,3 +239,5 @@ WebSocketTracker.prototype._generateOffers = function (numWant, cb) { } } } + +function noop () {}