Be sure to generate a DID_LOGOFF event, and a few other bits.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4283 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -390,11 +390,13 @@ public class Client extends EventDispatcher
|
||||
protected var _tickInterval :Timer;
|
||||
|
||||
// client observer constants
|
||||
/*
|
||||
internal static const CLIENT_DID_LOGON :int = 0;
|
||||
internal static const CLIENT_FAILED_TO_LOGON :int = 1;
|
||||
internal static const CLIENT_OBJECT_CHANGED :int = 2;
|
||||
internal static const CLIENT_CONNECTION_FAILED :int = 3;
|
||||
internal static const CLIENT_WILL_LOGOFF :int = 4;
|
||||
internal static const CLIENT_DID_LOGOFF :int = 5;
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,6 +189,13 @@ public class ClientDObjectMgr
|
||||
* messages that we have waiting in our queue.
|
||||
*/
|
||||
public function processNextAction (event :Event) :void
|
||||
{
|
||||
while (_actions.length > 0) {
|
||||
doNextAction();
|
||||
}
|
||||
}
|
||||
|
||||
protected function doNextAction () :void
|
||||
{
|
||||
// process the next event on our queue
|
||||
if (_actions.length == 0) {
|
||||
|
||||
@@ -126,6 +126,8 @@ public class Communicator
|
||||
|
||||
protected function shutdown (logonError :Error) :void
|
||||
{
|
||||
_client.notifyObservers(ClientEvent.CLIENT_DID_LOGOFF, null);
|
||||
|
||||
if (_socket != null) {
|
||||
try {
|
||||
_socket.close();
|
||||
@@ -146,6 +148,12 @@ public class Communicator
|
||||
|
||||
protected function sendMessage (msg :UpstreamMessage) :void
|
||||
{
|
||||
if (_outStream == null) {
|
||||
Log.getLog(this).warning(
|
||||
"No socket, dropping msg [msg=" + msg + "].");
|
||||
return;
|
||||
}
|
||||
|
||||
// write the message (ends up in _outBuffer)
|
||||
_outStream.writeObject(msg);
|
||||
|
||||
@@ -258,7 +266,7 @@ public class Communicator
|
||||
{
|
||||
Log.getLog(this).warning("socket was closed: " + event);
|
||||
_client.notifyObservers(ClientEvent.CLIENT_CONNECTION_FAILED);
|
||||
shutdown(null);
|
||||
logoff();
|
||||
}
|
||||
|
||||
protected var _client :Client;
|
||||
|
||||
Reference in New Issue
Block a user