Fixed up a number of TODOs; created a new Wrapped interface to simplify
auto-unwrapping. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4286 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -292,19 +292,29 @@ public class Client extends EventDispatcher
|
||||
notifyObservers(ClientEvent.CLIENT_FAILED_TO_LOGON, cause);
|
||||
}
|
||||
|
||||
// TODO: this should be 'internal' except for a fucking bug with AS3
|
||||
/**
|
||||
* Called by the invocation director when it successfully subscribes
|
||||
* to the client object immediately following logon.
|
||||
*/
|
||||
public function gotClientObject (clobj :ClientObject) :void
|
||||
{
|
||||
_clobj = clobj;
|
||||
notifyObservers(ClientEvent.CLIENT_DID_LOGON);
|
||||
}
|
||||
|
||||
// TODO: this should be 'internal' except for a fucking bug with AS3
|
||||
/**
|
||||
* Called by the invocation director if it fails to subscribe to the
|
||||
* client object after logon.
|
||||
*/
|
||||
public function getClientObjectFailed (cause :Error) :void
|
||||
{
|
||||
notifyObservers(ClientEvent.CLIENT_FAILED_TO_LOGON, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the invocation director when it discovers that the client
|
||||
* object has changed.
|
||||
*/
|
||||
protected function clientObjectDidChange (clobj :ClientObject) :void
|
||||
{
|
||||
_clobj = clobj;
|
||||
|
||||
@@ -24,6 +24,7 @@ package com.threerings.presents.client {
|
||||
import flash.events.Event;
|
||||
import flash.events.TimerEvent;
|
||||
import flash.utils.Timer;
|
||||
import flash.utils.getTimer; // function import
|
||||
|
||||
import mx.collections.IList;
|
||||
|
||||
@@ -141,22 +142,15 @@ public class ClientDObjectMgr
|
||||
{
|
||||
// if this object has a registered flush delay, don't can it just
|
||||
// yet, just slip it onto the flush queue
|
||||
var oclass :Class = ClassUtil.getClass(obj);
|
||||
/*
|
||||
// TODO
|
||||
// TODO
|
||||
for (Iterator iter = _delays.keySet().iterator(); iter.hasNext(); ) {
|
||||
Class dclass = (Class)iter.next();
|
||||
if (dclass.isAssignableFrom(oclass)) {
|
||||
long expire = System.currentTimeMillis() +
|
||||
((Long)_delays.get(dclass)).longValue();
|
||||
for each (var dclass :Class in _delays.keys()) {
|
||||
if (obj is dclass) {
|
||||
var expire :Number = getTimer() + Number(_delays.get(dclass));
|
||||
_flushes.put(obj.getOid(), new FlushRecord(obj, expire));
|
||||
// log.info("Flushing " + obj.getOid() + " at " +
|
||||
// new java.util.Date(expire));
|
||||
return;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// if we didn't find a delay registration, flush immediately
|
||||
flushObject(obj);
|
||||
@@ -169,8 +163,7 @@ public class ClientDObjectMgr
|
||||
*/
|
||||
public function registerFlushDelay (objclass :Class, delay :Number) :void
|
||||
{
|
||||
// TODO
|
||||
//_delays.put(objclass, new Long(delay));
|
||||
_delays.put(objclass, delay);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -424,8 +417,8 @@ public class ClientDObjectMgr
|
||||
*/
|
||||
protected function flushObjects (event :TimerEvent) :void
|
||||
{
|
||||
var now :Number = new Date().getTime();
|
||||
for (var oid :String in _flushes.keys()) {
|
||||
var now :Number = getTimer();
|
||||
for each (var oid :int in _flushes.keys()) {
|
||||
var rec :FlushRecord = (_flushes.get(oid) as FlushRecord);
|
||||
if (rec.expire <= now) {
|
||||
_flushes.remove(oid);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.threerings.presents.client {
|
||||
|
||||
import flash.utils.getTimer; // function import
|
||||
|
||||
import mx.collections.IViewCursor;
|
||||
import mx.collections.ArrayCollection;
|
||||
|
||||
@@ -145,7 +147,7 @@ public class InvocationDirector
|
||||
(arg as InvocationMarshaller_ListenerMarshaller);
|
||||
lm.callerOid = _clobj.getOid();
|
||||
lm.requestId = nextRequestId();
|
||||
lm.mapStamp = new Date().getTime();
|
||||
lm.mapStamp = getTimer();
|
||||
|
||||
// create a mapping for this marshaller so that we can
|
||||
// properly dispatch responses sent to it
|
||||
@@ -218,7 +220,7 @@ public class InvocationDirector
|
||||
}
|
||||
|
||||
// flush expired listeners periodically
|
||||
var now :Number = new Date().getTime();
|
||||
var now :Number = getTimer();
|
||||
if (now - _lastFlushTime > LISTENER_FLUSH_INTERVAL) {
|
||||
_lastFlushTime = now;
|
||||
flushListeners(now);
|
||||
@@ -272,11 +274,12 @@ public class InvocationDirector
|
||||
protected function flushListeners (now :Number) :void
|
||||
{
|
||||
var then :Number = now - LISTENER_MAX_AGE;
|
||||
for (var skey :String in _listeners.keys()) {
|
||||
for each (var reqId :int in _listeners.keys()) {
|
||||
var lm :InvocationMarshaller_ListenerMarshaller =
|
||||
(_listeners.get(skey) as InvocationMarshaller_ListenerMarshaller);
|
||||
(_listeners.get(reqId) as
|
||||
InvocationMarshaller_ListenerMarshaller);
|
||||
if (lm.mapStamp < then) {
|
||||
_listeners.remove(skey);
|
||||
_listeners.remove(reqId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user