Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/client/http-tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for cb &&. You can see that we just call cb() directly below. This is an internal function, so we're always sure that it's called with a cb parameter.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, should be cb(null) for consistency with how it's called below.

self.destroyed = true
clearInterval(self.interval)

Expand Down
2 changes: 1 addition & 1 deletion lib/client/udp-tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion lib/client/websocket-tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down