From e91215b6893983f1a326fc187e661e0da0f12ccb Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Wed, 4 Dec 2002 02:47:03 +0000 Subject: [PATCH] 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 --- .../threerings/crowd/server/CrowdClient.java | 17 ++++++++--------- .../presents/server/PresentsClient.java | 14 +++++++++++--- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/java/com/threerings/crowd/server/CrowdClient.java b/src/java/com/threerings/crowd/server/CrowdClient.java index d7398be6a..0a08571d3 100644 --- a/src/java/com/threerings/crowd/server/CrowdClient.java +++ b/src/java/com/threerings/crowd/server/CrowdClient.java @@ -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 diff --git a/src/java/com/threerings/presents/server/PresentsClient.java b/src/java/com/threerings/presents/server/PresentsClient.java index 28dc17edf..a6ba45fcf 100644 --- a/src/java/com/threerings/presents/server/PresentsClient.java +++ b/src/java/com/threerings/presents/server/PresentsClient.java @@ -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