mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2024-12-13 19:06:27 +00:00
after socket destroy, ignore all future errors
This commit is contained in:
parent
d0f384931f
commit
2505e13009
@ -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 () {}
|
||||
|
@ -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 () {}
|
||||
|
Loading…
Reference in New Issue
Block a user