Match the Java side's cleanup functionality. This also helps Flash garbage collect properly.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6752 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -537,6 +537,11 @@ public class Client extends EventDispatcher
|
||||
|
||||
internal function cleanup (logonError :Error) :void
|
||||
{
|
||||
// tell the object manager that we're no longer connected to the server
|
||||
if (_omgr is ClientDObjectMgr) {
|
||||
ClientDObjectMgr(_omgr).cleanup();
|
||||
}
|
||||
|
||||
// clear out our references
|
||||
_comm = null;
|
||||
_bstrap = null;
|
||||
|
||||
@@ -80,6 +80,27 @@ public class ClientDObjectMgr
|
||||
_flushInterval.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the client is cleaned up due to having disconnected from the server.
|
||||
*/
|
||||
public function cleanup () :void
|
||||
{
|
||||
// tell any pending object subscribers that they're not getting their bits
|
||||
for each (var req :PendingRequest in _penders.values()) {
|
||||
for each (var sub :Subscriber in req.targets) {
|
||||
sub.requestFailed(req.oid, new ObjectAccessError("Client connection closed"));
|
||||
}
|
||||
}
|
||||
_penders.clear();
|
||||
_flushes.clear();
|
||||
_dead.clear();
|
||||
_ocache.clear();
|
||||
|
||||
_flushInterval.stop();
|
||||
_flushInterval.removeEventListener(TimerEvent.TIMER, flushObjects);
|
||||
_flushInterval = null;
|
||||
}
|
||||
|
||||
// documentation inherited from interface DObjectManager
|
||||
public function isManager (object :DObject) :Boolean
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user