CIRCNetwork.cancel Member

Cancels the network's connection (whatever its current state).

Syntax

object.cancel();

Returns

Remarks

See Also

Source Code

function net_cancel()
{
// We're online, pull the plug on the current connection, or...
if (this.state == NET_ONLINE)
{
this.quit();
}
// We're waiting for the 001, too late to throw a reconnect, or...
else if (this.state == NET_CONNECTING)
{
this.state = NET_CANCELLING;
this.primServ.connection.disconnect();
// Throw the necessary error events:
ev = new CEvent ("network", "error", this, "onError");
ev.server = this;
ev.debug = "Connect sequence was cancelled.";
ev.errorCode = JSIRC_ERR_CANCELLED;
this.eventPump.addEvent(ev);
}
// We're waiting for onDoConnect, so try a reconnect (which will fail us)
else if (this.state == NET_WAITING)
{
this.state = NET_CANCELLING;
// onDoConnect will throw the error events for us, as it will fail
this.immediateConnect();
}
else
{
dd("Network cancel in odd state: " + this.state);
}
}