mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2024-12-13 19:06:27 +00:00
client: add http tracker destroy function
This commit is contained in:
parent
c048f1b2a9
commit
ee91dff19d
@ -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) {
|
HTTPTracker.prototype._request = function (requestUrl, opts, cb) {
|
||||||
var self = this
|
var self = this
|
||||||
|
|
||||||
@ -92,6 +97,7 @@ HTTPTracker.prototype._request = function (requestUrl, opts, cb) {
|
|||||||
common.querystringStringify(opts)
|
common.querystringStringify(opts)
|
||||||
|
|
||||||
get.concat(u, function (err, data, res) {
|
get.concat(u, function (err, data, res) {
|
||||||
|
if (self.destroyed) return
|
||||||
if (err) return self.client.emit('warning', err)
|
if (err) return self.client.emit('warning', err)
|
||||||
if (res.statusCode !== 200) {
|
if (res.statusCode !== 200) {
|
||||||
return self.client.emit('warning', new Error('Non-200 response code ' +
|
return self.client.emit('warning', new Error('Non-200 response code ' +
|
||||||
|
Loading…
Reference in New Issue
Block a user