mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2025-01-19 04:31:36 +00:00
fixed issue where an erroneous tracker could cause webtorrent to crash because socket.close was already closed after an error state
This commit is contained in:
parent
50d3379255
commit
c4684c8b72
6
index.js
6
index.js
@ -180,13 +180,11 @@ Tracker.prototype._requestUdp = function (requestUrl, opts) {
|
|||||||
|
|
||||||
function error (message) {
|
function error (message) {
|
||||||
self.client.emit('error', new Error(message + ' (connecting to tracker ' + requestUrl + ')'))
|
self.client.emit('error', new Error(message + ' (connecting to tracker ' + requestUrl + ')'))
|
||||||
socket.close()
|
try { socket.close() } catch (e) { }
|
||||||
clearTimeout(timeout)
|
clearTimeout(timeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
socket.on('error', function (err) {
|
socket.on('error', error)
|
||||||
error(err)
|
|
||||||
})
|
|
||||||
|
|
||||||
socket.on('message', function (message, rinfo) {
|
socket.on('message', function (message, rinfo) {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user