Skip to content

Commit 09e2b55

Browse files
committed
invoke callbacks of destroyed trackers
1 parent 5588419 commit 09e2b55

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

lib/client/http-tracker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ HTTPTracker.prototype.scrape = function (opts) {
7474

7575
HTTPTracker.prototype.destroy = function (cb) {
7676
var self = this
77-
if (self.destroyed) return
77+
if (self.destroyed) return cb && cb()
7878
self.destroyed = true
7979
clearInterval(self.interval)
8080

lib/client/udp-tracker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ UDPTracker.prototype.scrape = function (opts) {
4747

4848
UDPTracker.prototype.destroy = function (cb) {
4949
var self = this
50-
if (self.destroyed) return
50+
if (self.destroyed) return cb && cb()
5151
self.destroyed = true
5252
clearInterval(self.interval)
5353

lib/client/websocket-tracker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ WebSocketTracker.prototype.scrape = function (opts) {
6666

6767
WebSocketTracker.prototype.destroy = function (onclose) {
6868
var self = this
69-
if (self.destroyed) return
69+
if (self.destroyed) return onclose && onclose()
7070
self.destroyed = true
7171
clearInterval(self.interval)
7272

0 commit comments

Comments
 (0)