Check to be sure that the client is still around before we send the

invocation response. (Better to catch it and report it here than have the
dobjmgr complain when it tries to dispatch an event on a non-existent
object.)


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@224 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2001-08-11 02:02:24 +00:00
parent 23821aeff6
commit f17562945f
@@ -1,11 +1,14 @@
// //
// $Id: InvocationProvider.java,v 1.4 2001/08/11 00:05:58 mdb Exp $ // $Id: InvocationProvider.java,v 1.5 2001/08/11 02:02:24 mdb Exp $
package com.threerings.cocktail.cher.server; package com.threerings.cocktail.cher.server;
import com.threerings.cocktail.cher.dobj.MessageEvent; import com.samskivert.util.StringUtil;
import com.threerings.cocktail.cher.Log;
import com.threerings.cocktail.cher.data.ClientObject; import com.threerings.cocktail.cher.data.ClientObject;
import com.threerings.cocktail.cher.data.InvocationObject; import com.threerings.cocktail.cher.data.InvocationObject;
import com.threerings.cocktail.cher.dobj.MessageEvent;
/** /**
* Invocation providers should extend this class when implementing * Invocation providers should extend this class when implementing
@@ -114,10 +117,18 @@ public class InvocationProvider
protected void deliverResponse (ClientObject source, Object[] args) protected void deliverResponse (ClientObject source, Object[] args)
{ {
// create the response event // make sure they didn't go away in the meanwhile
MessageEvent mevt = new MessageEvent( if (source.isActive()) {
source.getOid(), InvocationObject.RESPONSE_NAME, args); // create the response event
// and ship it off MessageEvent mevt = new MessageEvent(
CherServer.omgr.postEvent(mevt); source.getOid(), InvocationObject.RESPONSE_NAME, args);
// and ship it off
CherServer.omgr.postEvent(mevt);
} else {
Log.warning("Dropping invrsp due to disappearing client " +
"[cloid=" + source.getOid() +
", args=" + StringUtil.toString(args) + "].");
}
} }
} }