@@ -36,13 +36,14 @@ inherits(Tracker, EventEmitter)
3636 * @param {Object } opts optional options
3737 */
3838function Tracker ( client , announceUrl , opts ) {
39- debug ( 'new tracker for ' + announceUrl )
4039 var self = this
4140 EventEmitter . call ( self )
4241 self . _opts = opts || { }
4342
4443 self . client = client
4544
45+ debug ( 'new tracker for ' + announceUrl )
46+
4647 self . _announceUrl = announceUrl
4748 self . _intervalMs = self . client . _intervalMs // use client interval initially
4849 self . _interval = null
@@ -56,38 +57,40 @@ function Tracker (client, announceUrl, opts) {
5657}
5758
5859Tracker . prototype . start = function ( opts ) {
59- debug ( 'sent `start` to ' + self . _announceUrl )
6060 var self = this
6161 opts = opts || { }
6262 opts . event = 'started'
63- self . _request ( opts )
6463
64+ debug ( 'sent `start` to ' + self . _announceUrl )
65+ self . _request ( opts )
6566 self . setInterval ( self . _intervalMs ) // start announcing on intervals
6667}
6768
6869Tracker . prototype . stop = function ( opts ) {
69- debug ( 'sent `stop` to ' + self . _announceUrl )
7070 var self = this
7171 opts = opts || { }
7272 opts . event = 'stopped'
73- self . _request ( opts )
7473
74+ debug ( 'sent `stop` to ' + self . _announceUrl )
75+ self . _request ( opts )
7576 self . setInterval ( 0 ) // stop announcing on intervals
7677}
7778
7879Tracker . prototype . complete = function ( opts ) {
79- debug ( 'sent `complete` to ' + self . _announceUrl )
8080 var self = this
8181 opts = opts || { }
8282 opts . event = 'completed'
8383 opts . downloaded = opts . downloaded || self . torrentLength || 0
84+
85+ debug ( 'sent `complete` to ' + self . _announceUrl )
8486 self . _request ( opts )
8587}
8688
8789Tracker . prototype . update = function ( opts ) {
88- debug ( 'sent `update` to ' + self . _announceUrl )
8990 var self = this
9091 opts = opts || { }
92+
93+ debug ( 'sent `update` to ' + self . _announceUrl )
9194 self . _request ( opts )
9295}
9396
0 commit comments