mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2024-12-14 03:16:24 +00:00
Max reconnect time
This commit is contained in:
parent
8e2dbdc576
commit
529203ea40
@ -16,6 +16,7 @@ var Tracker = require('./tracker')
|
|||||||
var socketPool = {}
|
var socketPool = {}
|
||||||
|
|
||||||
var RECONNECT_MINIMUM = 15 * 1000
|
var RECONNECT_MINIMUM = 15 * 1000
|
||||||
|
var RECONNECT_MAXIMUM = 5 * 60 * 1000
|
||||||
var RECONNECT_RETRY = 30 * 1000
|
var RECONNECT_RETRY = 30 * 1000
|
||||||
var OFFER_TIMEOUT = 50 * 1000
|
var OFFER_TIMEOUT = 50 * 1000
|
||||||
|
|
||||||
@ -235,7 +236,7 @@ WebSocketTracker.prototype._onSocketError = function (err) {
|
|||||||
|
|
||||||
WebSocketTracker.prototype._startReconnectTimer = function () {
|
WebSocketTracker.prototype._startReconnectTimer = function () {
|
||||||
var self = this
|
var self = this
|
||||||
var ms = RECONNECT_MINIMUM + (self.retries * RECONNECT_RETRY)
|
var ms = Math.min(RECONNECT_MINIMUM + (self.retries * RECONNECT_RETRY), RECONNECT_MAXIMUM)
|
||||||
|
|
||||||
self.reconnecting = true
|
self.reconnecting = true
|
||||||
var reconnectTimer = setTimeout(function () {
|
var reconnectTimer = setTimeout(function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user