From ee91dff19d714cb9674328cb9227af07dfaa1d7d Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Sat, 16 May 2015 22:55:41 -0700 Subject: [PATCH] client: add http tracker destroy function --- lib/http-tracker.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/http-tracker.js b/lib/http-tracker.js index 45e1d9b..a8396a7 100644 --- a/lib/http-tracker.js +++ b/lib/http-tracker.js @@ -85,6 +85,11 @@ HTTPTracker.prototype.setInterval = function (intervalMs) { } } +HTTPTracker.prototype.destroy = function () { + var self = this + self.destroyed = true +} + HTTPTracker.prototype._request = function (requestUrl, opts, cb) { var self = this @@ -92,6 +97,7 @@ HTTPTracker.prototype._request = function (requestUrl, opts, cb) { common.querystringStringify(opts) get.concat(u, function (err, data, res) { + if (self.destroyed) return if (err) return self.client.emit('warning', err) if (res.statusCode !== 200) { return self.client.emit('warning', new Error('Non-200 response code ' +