Skip to content

Commit c52169d

Browse files
committed
add debug messages
1 parent 125e9f5 commit c52169d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

index.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ inherits(Tracker, EventEmitter)
3636
* @param {Object} opts optional options
3737
*/
3838
function Tracker (client, announceUrl, opts) {
39+
debug('new tracker for ' + announceUrl)
3940
var self = this
4041
EventEmitter.call(self)
4142
self._opts = opts || {}
@@ -51,9 +52,11 @@ function Tracker (client, announceUrl, opts) {
5152
} else {
5253
self._requestImpl = self._requestHttp
5354
}
55+
5456
}
5557

5658
Tracker.prototype.start = function (opts) {
59+
debug('sent `start` to ' + self._announceUrl)
5760
var self = this
5861
opts = opts || {}
5962
opts.event = 'started'
@@ -63,6 +66,7 @@ Tracker.prototype.start = function (opts) {
6366
}
6467

6568
Tracker.prototype.stop = function (opts) {
69+
debug('sent `stop` to ' + self._announceUrl)
6670
var self = this
6771
opts = opts || {}
6872
opts.event = 'stopped'
@@ -72,6 +76,7 @@ Tracker.prototype.stop = function (opts) {
7276
}
7377

7478
Tracker.prototype.complete = function (opts) {
79+
debug('sent `complete` to ' + self._announceUrl)
7580
var self = this
7681
opts = opts || {}
7782
opts.event = 'completed'
@@ -80,6 +85,7 @@ Tracker.prototype.complete = function (opts) {
8085
}
8186

8287
Tracker.prototype.update = function (opts) {
88+
debug('sent `update` to ' + self._announceUrl)
8389
var self = this
8490
opts = opts || {}
8591
self._request(opts)
@@ -98,10 +104,13 @@ Tracker.prototype.scrape = function (opts) {
98104
}
99105

100106
if (!self._scrapeUrl) {
107+
debug('scrape not supported by ' + self._announceUrl)
101108
self.client.emit('error', new Error('scrape not supported for announceUrl ' + self._announceUrl))
102109
return
103110
}
104111

112+
debug('sent `scrape` to ' + self._announceUrl)
113+
105114
opts = extend({
106115
info_hash: bytewiseEncodeURIComponent(self.client._infoHash)
107116
}, opts)
@@ -428,7 +437,6 @@ function Client (peerId, port, torrent, opts) {
428437
torrent.announce = [torrent.announce]
429438
}
430439
self._trackers = torrent.announce.map(function (announceUrl) {
431-
debug('creating tracker for ' + announceUrl)
432440
return new Tracker(self, announceUrl, self._opts)
433441
})
434442
}

0 commit comments

Comments
 (0)