CIRCNetwork.getReconnectDelayMs Member

Calculates delay before the next automatic connection attempt.

Syntax

object.getReconnectDelayMs();

Returns

Remarks

If the number of connection attempts is limited, use fixed interval MIN_RECONNECT_MS. For unlimited attempts (-1), use exponential backoff: the interval between connection attempts to the network (not individual servers) is doubled after each attempt, up to MAX_RECONNECT_MS.

See Also

Source Code

function my_getReconnectDelayMs()
{
var nServers = this.serverList.length;
if ((-1 != this.MAX_CONNECT_ATTEMPTS) ||
(0 != this.connectCandidate % nServers))
{
return this.MIN_RECONNECT_MS;
}
var networkRound = Math.ceil(this.connectCandidate / nServers);
var rv = this.MIN_RECONNECT_MS * Math.pow(2, networkRound - 1);
// clamp rv between MIN/MAX_RECONNECT_MS
rv = Math.min(Math.max(rv, this.MIN_RECONNECT_MS), this.MAX_RECONNECT_MS);
return rv;
}