@@ -110,12 +110,10 @@ Tracker.prototype.scrape = function (opts) {
110110
111111Tracker . prototype . setInterval = function ( intervalMs ) {
112112 var self = this
113- if ( self . _interval ) {
114- clearInterval ( self . _interval )
115- }
113+ clearInterval ( self . _interval )
116114
117115 self . _intervalMs = intervalMs
118- if ( self . _intervalMs ) {
116+ if ( intervalMs ) {
119117 self . _interval = setInterval ( self . update . bind ( self ) , self . _intervalMs )
120118 }
121119}
@@ -497,7 +495,7 @@ function Server (opts) {
497495 EventEmitter . call ( self )
498496 opts = opts || { }
499497
500- self . _interval = opts . interval
498+ self . _intervalMs = opts . interval
501499 ? opts . interval / 1000
502500 : 10 * 60 // 10 min (in secs)
503501
@@ -666,7 +664,7 @@ Server.prototype._onHttpRequest = function (req, res) {
666664 complete : swarm . complete ,
667665 incomplete : swarm . incomplete ,
668666 peers : peers ,
669- interval : self . _interval
667+ interval : self . _intervalMs
670668 }
671669
672670 if ( warning ) {
@@ -683,7 +681,7 @@ Server.prototype._onHttpRequest = function (req, res) {
683681 incomplete : swarm . incomplete ,
684682 downloaded : swarm . complete , // TODO: this only provides a lower-bound
685683 flags : {
686- min_request_interval : self . _interval
684+ min_request_interval : self . _intervalMs
687685 }
688686 }
689687
@@ -830,7 +828,7 @@ Server.prototype._onUdpRequest = function (msg, rinfo) {
830828 send ( Buffer . concat ( [
831829 toUInt32 ( ACTIONS . ANNOUNCE ) ,
832830 toUInt32 ( transactionId ) ,
833- toUInt32 ( self . _interval ) ,
831+ toUInt32 ( self . _intervalMs ) ,
834832 toUInt32 ( swarm . incomplete ) ,
835833 toUInt32 ( swarm . complete ) ,
836834 peers
0 commit comments