Skip to content

Commit f5d2810

Browse files
committed
Announce to websocket tracker every 30 seconds (for webtorrent#338)
1 parent 9db28c2 commit f5d2810

File tree

5 files changed

+7
-5
lines changed

5 files changed

+7
-5
lines changed

lib/client/http-tracker.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ function HTTPTracker (client, announceUrl, opts) {
3434
}
3535
}
3636

37+
HTTPTracker.prototype.DEFAULT_ANNOUNCE_INTERVAL = 30 * 60 * 1000 // 30 minutes
38+
3739
HTTPTracker.prototype.announce = function (opts) {
3840
var self = this
3941
if (self.destroyed) return

lib/client/tracker.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ module.exports = Tracker
33
var EventEmitter = require('events').EventEmitter
44
var inherits = require('inherits')
55

6-
var common = require('../common')
7-
86
inherits(Tracker, EventEmitter)
97

108
function Tracker (client, announceUrl) {
@@ -20,7 +18,7 @@ function Tracker (client, announceUrl) {
2018
Tracker.prototype.setInterval = function (intervalMs) {
2119
var self = this
2220
if (self.interval) return
23-
if (intervalMs == null) intervalMs = common.DEFAULT_ANNOUNCE_INTERVAL
21+
if (intervalMs == null) intervalMs = self.DEFAULT_ANNOUNCE_INTERVAL
2422

2523
clearInterval(self.interval)
2624

lib/client/udp-tracker.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ function UDPTracker (client, announceUrl, opts) {
3030
self.cleanupFns = []
3131
}
3232

33+
UDPTracker.prototype.DEFAULT_ANNOUNCE_INTERVAL = 30 * 60 * 1000 // 30 minutes
34+
3335
UDPTracker.prototype.announce = function (opts) {
3436
var self = this
3537
if (self.destroyed) return

lib/client/websocket-tracker.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ function WebSocketTracker (client, announceUrl, opts) {
3232
self._openSocket()
3333
}
3434

35+
WebSocketTracker.prototype.DEFAULT_ANNOUNCE_INTERVAL = 30 * 1000 // 30 seconds
36+
3537
WebSocketTracker.prototype.announce = function (opts) {
3638
var self = this
3739
if (self.destroyed) return

lib/common.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
var extend = require('xtend/mutable')
66

7-
exports.DEFAULT_ANNOUNCE_INTERVAL = 30 * 60 * 1000 // 30 minutes
8-
97
exports.DEFAULT_ANNOUNCE_PEERS = 50
108
exports.MAX_ANNOUNCE_PEERS = 82
119

0 commit comments

Comments
 (0)