CIRCServer.onDisconnect Member

Syntax

object.onDisconnect(e);

Arguments

ArgumentSummary
e

Returns

Remarks

See Also

Source Code

function serv_disconnect(e)
{
function stateChangeFn(network, state) {
network.state = state;
};
function delayedConnectFn(network) {
network.delayedConnect();
};
/* If we're not connected and get this, it means we have almost certainly
* encountered a read or write error on the socket post-disconnect. There's
* no point propagating this any further, as we've already notified the
* user of the disconnect (with the right error).
*/
if (!this.isConnected)
return;
// Don't reconnect from a certificate error.
var certErrors = [SEC_ERROR_EXPIRED_CERTIFICATE, SEC_ERROR_UNKNOWN_ISSUER,
SEC_ERROR_UNTRUSTED_ISSUER, SEC_ERROR_UNTRUSTED_CERT,
SEC_ERROR_EXPIRED_ISSUER_CERTIFICATE,
SEC_ERROR_CA_CERT_INVALID, SEC_ERROR_INADEQUATE_KEY_USAGE,
SSL_ERROR_BAD_CERT_DOMAIN];
var certError = arrayContains(certErrors, e.disconnectStatus);
// Don't reconnect if our connection was aborted.
var wasAborted = (e.disconnectStatus == NS_ERROR_ABORT);
var dontReconnect = certError || wasAborted;
if (((this.parent.state == NET_CONNECTING) && !dontReconnect) ||
/* fell off while connecting, try again */
(this.parent.primServ == this) && (this.parent.state == NET_ONLINE) &&
(!("quitting" in this) && this.parent.stayingPower && !dontReconnect))
{ /* fell off primary server, reconnect to any host in the serverList */
setTimeout(delayedConnectFn, 0, this.parent);
}
else
{
setTimeout(stateChangeFn, 0, this.parent, NET_OFFLINE);
}
e.server = this;
e.set = "network";
e.destObject = this.parent;
e.quitting = this.quitting;
for (var c in this.channels)
{
this.channels[c].users = new Object();
this.channels[c].active = false;
}
this.connection = null;
this.isConnected = false;
delete this.quitting;
}