Skip to content

Commit 2505e13

Browse files
committed
after socket destroy, ignore all future errors
1 parent d0f3849 commit 2505e13

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

lib/udp-tracker.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ UDPTracker.prototype._request = function (opts) {
8787
}
8888
socket.removeListener('error', onError)
8989
socket.removeListener('message', onSocketMessage)
90+
socket.on('error', noop) // ignore all future errors
9091
try { socket.close() } catch (err) {}
9192
socket = null
9293
}
@@ -261,3 +262,5 @@ function toUInt64 (n) {
261262
}
262263
return Buffer.concat([common.toUInt32(0), common.toUInt32(n)])
263264
}
265+
266+
function noop () {}

lib/websocket-tracker.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ WebSocketTracker.prototype.destroy = function () {
8787
self._onSocketDataBound = null
8888
self._onSocketCloseBound = null
8989

90+
self._socket.on('error', noop) // ignore all future errors
9091
try { self._socket.close() } catch (e) {}
9192
self._socket = null
9293
}
@@ -238,3 +239,5 @@ WebSocketTracker.prototype._generateOffers = function (numWant, cb) {
238239
}
239240
}
240241
}
242+
243+
function noop () {}

0 commit comments

Comments
 (0)