Enhanced reporting in failure conditions; fixed a problem where attempting
to end the session of a client that was already ended would result in funny business. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1567 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: ClientManager.java,v 1.19 2002/04/26 02:34:11 mdb Exp $
|
// $Id: ClientManager.java,v 1.20 2002/07/10 01:26:21 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.presents.server;
|
package com.threerings.presents.server;
|
||||||
|
|
||||||
@@ -172,9 +172,16 @@ public class ClientManager implements ConnectionObserver
|
|||||||
{
|
{
|
||||||
// we only remove the mapping if there's not a session in progress
|
// we only remove the mapping if there's not a session in progress
|
||||||
// (which is indicated by an entry in the locks table)
|
// (which is indicated by an entry in the locks table)
|
||||||
if (!_locks.contains(username)) {
|
if (_locks.contains(username)) {
|
||||||
ClientObject clobj = (ClientObject)_objmap.remove(username);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ClientObject clobj = (ClientObject)_objmap.remove(username);
|
||||||
|
if (clobj != null) {
|
||||||
PresentsServer.omgr.destroyObject(clobj.getOid());
|
PresentsServer.omgr.destroyObject(clobj.getOid());
|
||||||
|
} else {
|
||||||
|
Log.warning("Requested to unmap non-existent client object " +
|
||||||
|
"[username=" + username + "].");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -274,6 +281,7 @@ public class ClientManager implements ConnectionObserver
|
|||||||
} else {
|
} else {
|
||||||
Log.info("Unmapped connection failed? [conn=" + conn +
|
Log.info("Unmapped connection failed? [conn=" + conn +
|
||||||
", fault=" + fault + "].");
|
", fault=" + fault + "].");
|
||||||
|
Thread.dumpStack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,6 +298,7 @@ public class ClientManager implements ConnectionObserver
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
Log.info("Closed unmapped connection? [conn=" + conn + "].");
|
Log.info("Closed unmapped connection? [conn=" + conn + "].");
|
||||||
|
Thread.dumpStack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -302,21 +311,29 @@ public class ClientManager implements ConnectionObserver
|
|||||||
String username = client.getUsername();
|
String username = client.getUsername();
|
||||||
// remove the client from the username map
|
// remove the client from the username map
|
||||||
PresentsClient rc = (PresentsClient)_usermap.remove(username);
|
PresentsClient rc = (PresentsClient)_usermap.remove(username);
|
||||||
// release the client session
|
|
||||||
releaseClient(username);
|
|
||||||
// and unmap (and destroy) their client object
|
|
||||||
unmapClientObject(username);
|
|
||||||
|
|
||||||
// sanity check just because we can
|
// sanity check just because we can
|
||||||
if (rc == null) {
|
if (rc == null) {
|
||||||
Log.warning("Unregistered client ended session " +
|
Log.warning("Unregistered client ended session " +
|
||||||
"[client=" + client + "].");
|
"[client=" + client + "].");
|
||||||
|
Thread.dumpStack();
|
||||||
|
|
||||||
|
// if they weren't in the username mapping, bail out now
|
||||||
|
// because the subsequent unmappings would just fail if we
|
||||||
|
// tried to do them for an unmapped client
|
||||||
|
return;
|
||||||
|
|
||||||
} else if (rc != client) {
|
} else if (rc != client) {
|
||||||
Log.warning("Different clients with same username!? " +
|
Log.warning("Different clients with same username!? " +
|
||||||
"[c1=" + rc + ", c2=" + client + "].");
|
"[c1=" + rc + ", c2=" + client + "].");
|
||||||
} else {
|
} else {
|
||||||
Log.info("Ending session [client=" + client + "].");
|
Log.info("Ending session [client=" + client + "].");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// release the client session
|
||||||
|
releaseClient(username);
|
||||||
|
// and unmap (and destroy) their client object
|
||||||
|
unmapClientObject(username);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** A mapping from usernames to client instances. */
|
/** A mapping from usernames to client instances. */
|
||||||
|
|||||||
Reference in New Issue
Block a user