From 09e2b55e4259ae005d5bba6985dd5453a6692b8f Mon Sep 17 00:00:00 2001 From: Autarc Date: Mon, 14 Mar 2016 17:13:34 +0100 Subject: [PATCH] invoke callbacks of destroyed trackers --- lib/client/http-tracker.js | 2 +- lib/client/udp-tracker.js | 2 +- lib/client/websocket-tracker.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/client/http-tracker.js b/lib/client/http-tracker.js index c8be443..ec10cc4 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 4bd98a5..8aec7e1 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 773aa83..df73062 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)