Allow client code to detect whether or not the client is connected, since isLoggedOn returns true during the dispatch of CLIENT_DID_LOGOFF. This will allow msoy to prevent the display of room change popups when the client is disconnected.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5790 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Jamie Doornbos
2009-05-19 18:05:07 +00:00
parent a6c43b3436
commit 8dd6472824
2 changed files with 19 additions and 0 deletions
@@ -234,6 +234,15 @@ public class Client extends EventDispatcher
return (_clobj != null);
}
/**
* Detects if the client is currently connected to the server. This can sometimes return false
* even though <code>isLoggedOn</code> returns true.
*/
public function isConnected () :Boolean
{
return _comm != null && _comm.isConnected();
}
/**
* Requests that this client connect and logon to the server with which it was previously
* configured.
@@ -85,6 +85,16 @@ public class Communicator
}
}
/**
* Detects if the communicator currently has an open channel to the server. This is guaranteed
* to return false while the logoff event is being dispatched. It also returns true during
* authentication, but prior to the client appearing to be logged on.
*/
public function isConnected () :Boolean
{
return _writer != null;
}
/**
* Attempts to logon on using the port at the specified index.
*/