Changed some things around with a few helper classes.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3910 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -459,6 +459,9 @@ public class ClientDObjectMgr
|
||||
}
|
||||
}
|
||||
|
||||
import com.threerings.presents.dobj.DObject;
|
||||
import com.threerings.presents.dobj.Subscriber;
|
||||
|
||||
/**
|
||||
* The object action is used to queue up a subscribe or unsubscribe
|
||||
* request.
|
||||
@@ -466,12 +469,11 @@ public class ClientDObjectMgr
|
||||
class ObjectAction
|
||||
{
|
||||
public var oid :int;
|
||||
public var target :com.threerings.presents.dobj.Subscriber;
|
||||
public var target :Subscriber;
|
||||
public var subscribe :Boolean;
|
||||
|
||||
public function ObjectAction (
|
||||
oid :int, target :com.threerings.presents.dobj.Subscriber,
|
||||
subscribe :Boolean)
|
||||
oid :int, target :Subscriber, subscribe :Boolean)
|
||||
{
|
||||
this.oid = oid;
|
||||
this.target = target;
|
||||
@@ -494,8 +496,7 @@ class PendingRequest
|
||||
this.oid = oid;
|
||||
}
|
||||
|
||||
public function addTarget (
|
||||
target :com.threerings.presents.dobj.Subscriber) :void
|
||||
public function addTarget (target :Subscriber) :void
|
||||
{
|
||||
targets.push(target);
|
||||
}
|
||||
@@ -505,13 +506,12 @@ class PendingRequest
|
||||
class FlushRecord
|
||||
{
|
||||
/** The object to be flushed. */
|
||||
public var obj :com.threerings.presents.dobj.DObject;
|
||||
public var obj :DObject;
|
||||
|
||||
/** The time at which we flush it. */
|
||||
public var expire :Number;
|
||||
|
||||
public function FlushRecord (
|
||||
obj :com.threerings.presents.dobj.DObject, expire :Number)
|
||||
public function FlushRecord (obj :DObject, expire :Number)
|
||||
{
|
||||
this.obj = obj;
|
||||
this.expire = expire;
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.threerings.presents.client {
|
||||
|
||||
import com.threerings.presents.client.InvocationDirector;
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
import com.threerings.presents.dobj.DObject;
|
||||
import com.threerings.presents.dobj.ObjectAccessError;
|
||||
import com.threerings.presents.dobj.Subscriber;
|
||||
import com.threerings.presents.Log;
|
||||
|
||||
/**
|
||||
* This class is used by the InvocationDirector to subscribe
|
||||
* to the client object.
|
||||
*/
|
||||
internal class ClientSubscriber implements Subscriber
|
||||
{
|
||||
public function ClientSubscriber (invdir :InvocationDirector)
|
||||
{
|
||||
_invdir = invdir;
|
||||
}
|
||||
|
||||
// documentation inherited from interface Subscriber
|
||||
public function objectAvailable (obj :DObject) :void
|
||||
{
|
||||
_invdir.gotClientObject(obj as ClientObject);
|
||||
}
|
||||
|
||||
// documentation inherited from interface Subscriber
|
||||
public function requestFailed (oid :int, cause :ObjectAccessError) :void
|
||||
{
|
||||
_invdir.gotClientObjectFailed(oid, cause);
|
||||
}
|
||||
|
||||
protected var _invdir :InvocationDirector;
|
||||
}
|
||||
}
|
||||
@@ -308,7 +308,7 @@ public class InvocationDirector
|
||||
* Called by the ClientSubscriber helper class when the client object
|
||||
* has been returned by the server.
|
||||
*/
|
||||
public function gotClientObject (clobj :ClientObject) :void
|
||||
internal function gotClientObject (clobj :ClientObject) :void
|
||||
{
|
||||
clobj.addListener(this);
|
||||
clobj.setReceivers(new DSet());
|
||||
@@ -321,8 +321,8 @@ public class InvocationDirector
|
||||
/**
|
||||
* Called by the ClientSubscriber helper class when it fails.
|
||||
*/
|
||||
public function gotClientObjectFailed (oid :int, cause :ObjectAccessError)
|
||||
:void
|
||||
internal function gotClientObjectFailed (
|
||||
oid :int, cause :ObjectAccessError) :void
|
||||
{
|
||||
Log.warning("Invocation director unable to subscribe to " +
|
||||
"client object [cloid=" + oid + ", cause=" + cause + "]!");
|
||||
@@ -366,30 +366,3 @@ public class InvocationDirector
|
||||
protected const LISTENER_MAX_AGE :int = 90 * 1000;
|
||||
}
|
||||
}
|
||||
|
||||
import com.threerings.presents.client.InvocationDirector;
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
import com.threerings.presents.dobj.DObject;
|
||||
import com.threerings.presents.dobj.ObjectAccessError;
|
||||
import com.threerings.presents.dobj.Subscriber;
|
||||
import com.threerings.presents.Log;
|
||||
|
||||
class ClientSubscriber implements Subscriber
|
||||
{
|
||||
public function ClientSubscriber (invdir :InvocationDirector)
|
||||
{
|
||||
_invdir = invdir;
|
||||
}
|
||||
|
||||
public function objectAvailable (obj :DObject) :void
|
||||
{
|
||||
_invdir.gotClientObject(obj as ClientObject);
|
||||
}
|
||||
|
||||
public function requestFailed (oid :int, cause :ObjectAccessError) :void
|
||||
{
|
||||
_invdir.gotClientObjectFailed(oid, cause);
|
||||
}
|
||||
|
||||
protected var _invdir :InvocationDirector;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user