Skip to content

Commit d78b678

Browse files
committed
fix regression: double cleanup bug
1 parent 89a4e07 commit d78b678

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

lib/http-tracker.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ function HTTPTracker (client, announceUrl, opts) {
2626
debug('new http tracker %s', announceUrl)
2727

2828
self.client = client
29+
self.destroyed = false
2930

3031
self._opts = opts
3132
self._announceUrl = announceUrl

lib/udp-tracker.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ function UDPTracker (client, announceUrl, opts) {
2828
debug('new udp tracker %s', announceUrl)
2929

3030
self.client = client
31+
self.destroyed = false
3132

3233
self._opts = opts
3334
self._announceUrl = announceUrl
@@ -95,10 +96,8 @@ UDPTracker.prototype._request = function (opts) {
9596
var ms = opts.event === 'stopped' ? TIMEOUT / 10 : TIMEOUT
9697
var timeout = setTimeout(function () {
9798
timeout = null
98-
cleanup()
99-
if (opts.event !== 'stopped') {
100-
onError(new Error('tracker request timed out'))
101-
}
99+
if (opts.event === 'stopped') cleanup()
100+
else onError(new Error('tracker request timed out (' + opts.event + ')'))
102101
}, ms)
103102
if (timeout.unref) timeout.unref()
104103

lib/websocket-tracker.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ function WebSocketTracker (client, announceUrl, opts) {
2222
debug('new websocket tracker %s', announceUrl)
2323

2424
self.client = client
25+
self.destroyed = false
2526

2627
self._opts = opts
2728
self._announceUrl = announceUrl

0 commit comments

Comments
 (0)