diff --git a/lib/client/http-tracker.js b/lib/client/http-tracker.js index c8be4438..ec10cc48 100644 --- a/lib/client/http-tracker.js +++ b/lib/client/http-tracker.js @@ -74,7 +74,7 @@ HTTPTracker.prototype.scrape = function (opts) { HTTPTracker.prototype.destroy = function (cb) { var self = this - if (self.destroyed) return + if (self.destroyed) return cb && cb() self.destroyed = true clearInterval(self.interval) diff --git a/lib/client/udp-tracker.js b/lib/client/udp-tracker.js index 4bd98a5a..8aec7e1a 100644 --- a/lib/client/udp-tracker.js +++ b/lib/client/udp-tracker.js @@ -47,7 +47,7 @@ UDPTracker.prototype.scrape = function (opts) { UDPTracker.prototype.destroy = function (cb) { var self = this - if (self.destroyed) return + if (self.destroyed) return cb && cb() self.destroyed = true clearInterval(self.interval) diff --git a/lib/client/websocket-tracker.js b/lib/client/websocket-tracker.js index 773aa833..df730627 100644 --- a/lib/client/websocket-tracker.js +++ b/lib/client/websocket-tracker.js @@ -66,7 +66,7 @@ WebSocketTracker.prototype.scrape = function (opts) { WebSocketTracker.prototype.destroy = function (onclose) { var self = this - if (self.destroyed) return + if (self.destroyed) return onclose && onclose() self.destroyed = true clearInterval(self.interval)