mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2024-12-13 19:06:27 +00:00
Variance and higher max
This commit is contained in:
parent
529203ea40
commit
050d95ac72
@ -16,8 +16,8 @@ var Tracker = require('./tracker')
|
||||
var socketPool = {}
|
||||
|
||||
var RECONNECT_MINIMUM = 15 * 1000
|
||||
var RECONNECT_MAXIMUM = 5 * 60 * 1000
|
||||
var RECONNECT_RETRY = 30 * 1000
|
||||
var RECONNECT_MAXIMUM = 30 * 60 * 1000
|
||||
var RECONNECT_VARIANCE = 30 * 1000
|
||||
var OFFER_TIMEOUT = 50 * 1000
|
||||
|
||||
inherits(WebSocketTracker, Tracker)
|
||||
@ -236,7 +236,7 @@ WebSocketTracker.prototype._onSocketError = function (err) {
|
||||
|
||||
WebSocketTracker.prototype._startReconnectTimer = function () {
|
||||
var self = this
|
||||
var ms = Math.min(RECONNECT_MINIMUM + (self.retries * RECONNECT_RETRY), RECONNECT_MAXIMUM)
|
||||
var ms = Math.floor(Math.random() * RECONNECT_VARIANCE) + Math.min(Math.pow(2, self.retries) * RECONNECT_MINIMUM, RECONNECT_MAXIMUM)
|
||||
|
||||
self.reconnecting = true
|
||||
var reconnectTimer = setTimeout(function () {
|
||||
|
Loading…
Reference in New Issue
Block a user