Explicitly pass along the client object to sessionConnectionClosed()

because it will have been cleared out of _clobj by the time said method is
called if it is called as a part of a terminated session.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2021 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-12-04 02:47:03 +00:00
parent 6552b5bd8b
commit e91215b689
2 changed files with 19 additions and 12 deletions
@@ -1,8 +1,9 @@
//
// $Id: CrowdClient.java,v 1.19 2002/12/03 06:58:57 mdb Exp $
// $Id: CrowdClient.java,v 1.20 2002/12/04 02:47:03 mdb Exp $
package com.threerings.crowd.server;
import com.threerings.presents.data.ClientObject;
import com.threerings.presents.server.PresentsClient;
import com.threerings.crowd.Log;
@@ -18,16 +19,14 @@ import com.threerings.crowd.server.CrowdServer;
public class CrowdClient extends PresentsClient
{
// documentation inherited
protected void sessionConnectionClosed ()
protected void sessionConnectionClosed (ClientObject clobj)
{
super.sessionConnectionClosed();
super.sessionConnectionClosed(clobj);
if (_clobj != null) {
// note that the user's disconnected
BodyObject bobj = (BodyObject)_clobj;
BodyProvider.updateOccupantStatus(
bobj, bobj.location, OccupantInfo.DISCONNECTED);
}
// note that the user's disconnected
BodyObject bobj = (BodyObject)clobj;
BodyProvider.updateOccupantStatus(
bobj, bobj.location, OccupantInfo.DISCONNECTED);
}
// documentation inherited
@@ -1,5 +1,5 @@
//
// $Id: PresentsClient.java,v 1.45 2002/11/26 02:14:25 mdb Exp $
// $Id: PresentsClient.java,v 1.46 2002/12/04 02:47:03 mdb Exp $
package com.threerings.presents.server;
@@ -507,6 +507,10 @@ public class PresentsClient
// clear out our connection reference
setConnection(null);
// we want to pass this to session connection closed even if we
// end up clearing it out before that method is actually run
final ClientObject clobj = _clobj;
// clear out our subscriptions. we need to do this on the dobjmgr
// thread. it is important that we do this *after* we clear out
// our connection reference. once the connection ref is null, no
@@ -514,7 +518,7 @@ public class PresentsClient
// queued up before the connection went away)
PresentsServer.omgr.postUnit(new Runnable() {
public void run () {
sessionConnectionClosed();
sessionConnectionClosed(clobj);
}
});
}
@@ -524,8 +528,12 @@ public class PresentsClient
* this session has been closed and unmapped. If the user logged off
* before closing their connection, this will be preceded by a call to
* {@link #sessionDidEnd}.
*
* @param clobj the client object is explicitly passed to this method
* because {@link #_clobj} may have already been cleared out if this
* is being called due to the termination of a session.
*/
protected void sessionConnectionClosed ()
protected void sessionConnectionClosed (ClientObject clobj)
{
// clear out our dobj subscriptions in case they weren't cleared
// by a call to sessionDidEnd