If we lose our connection, let anyone who had a pending subscription request
outstanding know that their subscription request failed. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4873 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -666,6 +666,11 @@ public class Client
|
||||
// ensure that it won't happen until CLIENT_DID_LOGOFF was dispatched
|
||||
_runQueue.postRunnable(new Runnable() {
|
||||
public void run () {
|
||||
// tell the object manager that we're no longer connected to the server
|
||||
if (_omgr instanceof ClientDObjectMgr) {
|
||||
((ClientDObjectMgr)_omgr).cleanup();
|
||||
}
|
||||
|
||||
// clear out our references
|
||||
_comm = null;
|
||||
_omgr = null;
|
||||
|
||||
@@ -185,6 +185,20 @@ public class ClientDObjectMgr
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the client is cleaned up due to having disconnected from the server.
|
||||
*/
|
||||
public void cleanup ()
|
||||
{
|
||||
// tell any pending object subscribers that they're not getting their bits
|
||||
for (PendingRequest<?> req : _penders.values()) {
|
||||
for (Subscriber<?> sub : req.targets) {
|
||||
sub.requestFailed(req.oid, new ObjectAccessException("Client connection closed"));
|
||||
}
|
||||
}
|
||||
_penders.clear();
|
||||
}
|
||||
|
||||
protected <T extends DObject> void queueAction (
|
||||
int oid, Subscriber<T> target, boolean subscribe)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user