@@ -42,8 +42,8 @@ function Server (opts) {
4242 opts = opts || { }
4343
4444 self . _intervalMs = opts . interval
45- ? opts . interval / 1000
46- : 10 * 60 // 10 min (in secs)
45+ ? opts . interval
46+ : 10 * 60 * 1000 // 10 min
4747
4848 self . _trustProxy = ! ! opts . trustProxy
4949
@@ -209,7 +209,7 @@ Server.prototype._onAnnounce = function (params, cb) {
209209 swarm . announce ( params , function ( err , response ) {
210210 if ( response ) {
211211 if ( ! response . action ) response . action = common . ACTIONS . ANNOUNCE
212- if ( ! response . intervalMs ) response . intervalMs = self . _intervalMs
212+ if ( ! response . interval ) response . interval = Math . ceil ( self . _intervalMs / 1000 )
213213
214214 if ( params . compact === 1 ) {
215215 var peers = response . peers
@@ -258,7 +258,7 @@ Server.prototype._onScrape = function (params, cb) {
258258 var response = {
259259 action : common . ACTIONS . SCRAPE ,
260260 files : { } ,
261- flags : { min_request_interval : self . _intervalMs }
261+ flags : { min_request_interval : Math . ceil ( self . _intervalMs / 1000 ) }
262262 }
263263
264264 results . forEach ( function ( result ) {
@@ -285,7 +285,7 @@ function makeUdpPacket (params) {
285285 return Buffer . concat ( [
286286 common . toUInt32 ( common . ACTIONS . ANNOUNCE ) ,
287287 common . toUInt32 ( params . transactionId ) ,
288- common . toUInt32 ( params . intervalMs ) ,
288+ common . toUInt32 ( params . interval ) ,
289289 common . toUInt32 ( params . incomplete ) ,
290290 common . toUInt32 ( params . complete ) ,
291291 params . peers
0 commit comments