Announce to websocket tracker every 30 seconds (for #338)

This commit is contained in:
Feross Aboukhadijeh 2015-07-29 02:12:14 -07:00
parent 9db28c2fad
commit f5d2810c89
5 changed files with 7 additions and 5 deletions

View File

@ -34,6 +34,8 @@ function HTTPTracker (client, announceUrl, opts) {
}
}
HTTPTracker.prototype.DEFAULT_ANNOUNCE_INTERVAL = 30 * 60 * 1000 // 30 minutes
HTTPTracker.prototype.announce = function (opts) {
var self = this
if (self.destroyed) return

View File

@ -3,8 +3,6 @@ module.exports = Tracker
var EventEmitter = require('events').EventEmitter
var inherits = require('inherits')
var common = require('../common')
inherits(Tracker, EventEmitter)
function Tracker (client, announceUrl) {
@ -20,7 +18,7 @@ function Tracker (client, announceUrl) {
Tracker.prototype.setInterval = function (intervalMs) {
var self = this
if (self.interval) return
if (intervalMs == null) intervalMs = common.DEFAULT_ANNOUNCE_INTERVAL
if (intervalMs == null) intervalMs = self.DEFAULT_ANNOUNCE_INTERVAL
clearInterval(self.interval)

View File

@ -30,6 +30,8 @@ function UDPTracker (client, announceUrl, opts) {
self.cleanupFns = []
}
UDPTracker.prototype.DEFAULT_ANNOUNCE_INTERVAL = 30 * 60 * 1000 // 30 minutes
UDPTracker.prototype.announce = function (opts) {
var self = this
if (self.destroyed) return

View File

@ -32,6 +32,8 @@ function WebSocketTracker (client, announceUrl, opts) {
self._openSocket()
}
WebSocketTracker.prototype.DEFAULT_ANNOUNCE_INTERVAL = 30 * 1000 // 30 seconds
WebSocketTracker.prototype.announce = function (opts) {
var self = this
if (self.destroyed) return

View File

@ -4,8 +4,6 @@
var extend = require('xtend/mutable')
exports.DEFAULT_ANNOUNCE_INTERVAL = 30 * 60 * 1000 // 30 minutes
exports.DEFAULT_ANNOUNCE_PEERS = 50
exports.MAX_ANNOUNCE_PEERS = 82