More crap, some new discoveries, backtracking, annoyance.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3918 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -208,14 +208,13 @@ public class ClientDObjectMgr
|
||||
|
||||
} else if (obj is UnsubscribeResponse) {
|
||||
var oid :int = obj.getOid();
|
||||
if (_dead[oid] == null) {
|
||||
if (_dead.remove(oid) == null) {
|
||||
Log.warning("Received unsub ACK from unknown object " +
|
||||
"[oid=" + oid + "].");
|
||||
}
|
||||
_dead[oid] = undefined;
|
||||
|
||||
} else if (obj is FailureResponse) {
|
||||
var oid :int = obj.getOid();
|
||||
var oid :int = (obj as FailureResponse).getOid();
|
||||
notifyFailure(oid);
|
||||
|
||||
} else if (obj is PongResponse) {
|
||||
@@ -250,9 +249,9 @@ public class ClientDObjectMgr
|
||||
|
||||
// look up the object on which we're dispatching this event
|
||||
var toid :int = event.getTargetOid();
|
||||
var target :DObject = _ocache[toid];
|
||||
var target :DObject = (_ocache.get(toid) as DEvent);
|
||||
if (target == null) {
|
||||
if (_dead[toid] === undefined) {
|
||||
if (_dead.get(toid) == null) {
|
||||
Log.warning("Unable to dispatch event on non-proxied " +
|
||||
"object [event=" + event + "].");
|
||||
}
|
||||
@@ -269,7 +268,7 @@ public class ClientDObjectMgr
|
||||
// Log.info("Pitching destroyed object " +
|
||||
// "[oid=" + toid + ", class=" +
|
||||
// StringUtil.shortClassName(target) + "].");
|
||||
_ocache[toid] = undefined;
|
||||
_ocache.remove(toid);
|
||||
}
|
||||
|
||||
// have the object pass this event on to its listeners
|
||||
@@ -295,7 +294,7 @@ public class ClientDObjectMgr
|
||||
|
||||
var oid :int = obj.getOid();
|
||||
// stick the object into the proxy object table
|
||||
_ocache[oid] = obj;
|
||||
_ocache.put(oid, obj);
|
||||
|
||||
// let the penders know that the object is available
|
||||
var req :PendingRequest = (_penders.remove(oid) as PendingRequest);
|
||||
@@ -321,8 +320,7 @@ public class ClientDObjectMgr
|
||||
protected function notifyFailure (oid :int) :void
|
||||
{
|
||||
// let the penders know that the object is not available
|
||||
var req :PendingRequest = _penders[oid];
|
||||
_penders[oid] = undefined;
|
||||
var req :PendingRequest = (_penders.remove(oid) as PendingRequest);
|
||||
if (req == null) {
|
||||
Log.warning("Failed to get object, but no one cares?! " +
|
||||
"[oid=" + oid + "].");
|
||||
@@ -345,10 +343,10 @@ public class ClientDObjectMgr
|
||||
// Log.info("doSubscribe: " + oid + ": " + target);
|
||||
|
||||
// first see if we've already got the object in our table
|
||||
var obj :DObject = _ocache[oid];
|
||||
var obj :DObject = (_ocache.get(oid) as DObject);
|
||||
if (obj != null) {
|
||||
// clear the object out of the flush table if it's in there
|
||||
_flushes[oid] = undefined;
|
||||
_flushes.remove(oid);
|
||||
// add the subscriber and call them back straight away
|
||||
obj.addSubscriber(target);
|
||||
target.objectAvailable(obj);
|
||||
@@ -356,7 +354,7 @@ public class ClientDObjectMgr
|
||||
}
|
||||
|
||||
// see if we've already got an outstanding request for this object
|
||||
var req :PendingRequest = _penders[oid];
|
||||
var req :PendingRequest = (_penders.get(oid) as PendingRequest);
|
||||
if (req != null) {
|
||||
// add this subscriber to the list of subscribers to be
|
||||
// notified when the request is satisfied
|
||||
@@ -367,7 +365,7 @@ public class ClientDObjectMgr
|
||||
// otherwise we need to create a new request
|
||||
req = new PendingRequest(oid);
|
||||
req.addTarget(target);
|
||||
_penders[oid] = req;
|
||||
_penders.put(oid, req);
|
||||
// Log.info("Registering pending request [oid=" + oid + "].");
|
||||
|
||||
// and issue a request to get things rolling
|
||||
@@ -380,7 +378,7 @@ public class ClientDObjectMgr
|
||||
*/
|
||||
protected function doUnsubscribe (oid :int, target :Subscriber) :void
|
||||
{
|
||||
var dobj :DObject = _ocache[oid];
|
||||
var dobj :DObject = (_ocache.get(oid) as DObject);
|
||||
if (dobj != null) {
|
||||
dobj.removeSubscriber(target);
|
||||
|
||||
@@ -401,8 +399,8 @@ public class ClientDObjectMgr
|
||||
// have it around anymore; once our unsubscribe message is
|
||||
// processed, it'll be 86ed
|
||||
var ooid :int = obj.getOid();
|
||||
_ocache[ooid] = undefined;
|
||||
_dead[ooid] = obj;
|
||||
_ocache.remove(ooid);
|
||||
_dead.put(ooid, obj);
|
||||
|
||||
// ship off an unsubscribe message to the server; we'll remove the
|
||||
// object from our table when we get the unsub ack
|
||||
@@ -416,10 +414,10 @@ public class ClientDObjectMgr
|
||||
protected function flushObjects () :void
|
||||
{
|
||||
var now :Number = new Date().getTime();
|
||||
for (var oid :String in _flushes) {
|
||||
var rec :FlushRecord = _flushes[oid];
|
||||
for (var oid :String in _flushes.keys()) {
|
||||
var rec :FlushRecord = (_flushes.get(oid) as FlushRecord);
|
||||
if (rec.expire <= now) {
|
||||
_flushes[oid] = undefined;
|
||||
_flushes.remove(oid);
|
||||
flushObject(rec.obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.threerings.io.FrameAvailableEvent;
|
||||
import com.threerings.io.FrameReader;
|
||||
import com.threerings.io.ObjectInputStream;
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
import com.threerings.io.Translations;
|
||||
|
||||
import com.threerings.presents.Log;
|
||||
|
||||
@@ -57,9 +58,8 @@ public class Communicator
|
||||
|
||||
private function addClassTranslations () :void
|
||||
{
|
||||
_inStream.addTranslation("com.threerings.presents.dobj.DSet$Entry",
|
||||
"com.threerings.presents.dobj.DSetEntry");
|
||||
_outStream.addTranslation("com.threerings.presents.dobj.DSetEntry",
|
||||
Translations.addTranslation(
|
||||
"com.threerings.presents.dobj.DSetEntry",
|
||||
"com.threerings.presents.dobj.DSet$Entry");
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ public class Communicator
|
||||
// write the message (ends up in _outBuffer)
|
||||
_outStream.writeObject(msg);
|
||||
|
||||
//Log.debug("outBuffer: " + Util.bytesToString(_outBuffer));
|
||||
Log.debug("outBuffer: " + Util.bytesToString(_outBuffer));
|
||||
|
||||
// Frame it by writing the length, then the bytes.
|
||||
// We add 4 to the length, because the length is of the entire frame
|
||||
|
||||
@@ -103,7 +103,7 @@ public class InvocationDirector
|
||||
var reg :InvocationRegistration = new InvocationRegistration(
|
||||
decoder.getReceiverCode(), nextReceiverId());
|
||||
_clobj.addToReceivers(reg);
|
||||
_receivers[reg.receiverId] = decoder;
|
||||
_receivers.put(reg.receiverId, decoder);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -139,7 +139,7 @@ public class InvocationDirector
|
||||
|
||||
// create a mapping for this marshaller so that we can
|
||||
// properly dispatch responses sent to it
|
||||
_listeners[lm.requestId] = lm;
|
||||
_listeners.put(lm.requestId, lm);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ public class InvocationDirector
|
||||
(reqId :int, methodId :int, args :Array) :void
|
||||
{
|
||||
var listener :ListenerMarshaller =
|
||||
(_listeners.remove(reqId) as ListenerMarshaller);
|
||||
(_listeners.remove(reqId) as ListenerMarshaller);
|
||||
if (listener == null) {
|
||||
Log.warning("Received invocation response for which we have " +
|
||||
"no registered listener [reqId=" + reqId +
|
||||
@@ -229,7 +229,7 @@ public class InvocationDirector
|
||||
{
|
||||
// look up the decoder registered for this receiver
|
||||
var decoder :InvocationDecoder =
|
||||
(_receivers[receiverId] as InvocationDecoder);
|
||||
(_receivers.get(receiverId) as InvocationDecoder);
|
||||
if (decoder == null) {
|
||||
Log.warning("Received notification for which we have no " +
|
||||
"registered receiver [recvId=" + receiverId +
|
||||
@@ -268,11 +268,11 @@ public class InvocationDirector
|
||||
protected function flushListeners (now :Number) :void
|
||||
{
|
||||
var then :Number = now - LISTENER_MAX_AGE;
|
||||
for (var skey :String in _listeners) {
|
||||
for (var skey :String in _listeners.keys()) {
|
||||
var lm :ListenerMarshaller =
|
||||
(_listeners[skey] as ListenerMarshaller);
|
||||
(_listeners.get(skey) as ListenerMarshaller);
|
||||
if (lm.mapStamp < then) {
|
||||
_listeners.clear(skey);
|
||||
_listeners.remove(skey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,13 +15,41 @@ public class TestClient extends Client
|
||||
setServer("tasman.sea.earth.threerings.net", DEFAULT_SERVER_PORT);
|
||||
logon();
|
||||
|
||||
var a :Object = new HelperClass(this);
|
||||
var g1 :String = null;
|
||||
var g2 :String = String(g1);
|
||||
Log.debug("foo: " + (g1 === g2));
|
||||
|
||||
Log.debug("instance: " + describeType(a).toXMLString());
|
||||
Log.debug("class : " + describeType(HelperClass).toXMLString());
|
||||
var duckie :Duck = new Goose();
|
||||
duckie.screw();
|
||||
|
||||
var arr :Array = new Array();
|
||||
arr[0] = "Florp";
|
||||
arr[1] = "Blanger";
|
||||
arr[2] = "Swissbrat";
|
||||
|
||||
for (var key:* in arr) {
|
||||
Log.debug("a key=" + key + " -> " + arr[key]);
|
||||
}
|
||||
delete arr[1];
|
||||
arr["1"] = "oinkenheimer";
|
||||
for (var key:* in arr) {
|
||||
Log.debug("a key=" + key + " -> " + arr[key]);
|
||||
}
|
||||
Log.debug("length: " + arr.length);
|
||||
Log.debug("arr[0]: " + arr[0]);
|
||||
Log.debug("arr[1]: " + arr[1]);
|
||||
Log.debug("arr[2]: " + arr[2]);
|
||||
|
||||
/*
|
||||
var b :Object = new PooperClass();
|
||||
var a :Object = new OldClass();
|
||||
var c :Class = OldClass;
|
||||
|
||||
Log.debug("instance: " + describeType(a).toXMLString());
|
||||
Log.debug("class : " + describeType(Pork).toXMLString());
|
||||
*/
|
||||
|
||||
/*
|
||||
var b :Object = new OldClass();
|
||||
var c :Object = 2.4;
|
||||
var d :Object = new HooperClass(this);
|
||||
|
||||
@@ -74,6 +102,13 @@ public class TestClient extends Client
|
||||
import com.threerings.presents.Log;
|
||||
import com.threerings.presents.client.TestClient;
|
||||
|
||||
dynamic class OldClass
|
||||
{
|
||||
public function OldClass ()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
class HelperClass
|
||||
{
|
||||
public function HelperClass (cli :TestClient)
|
||||
@@ -113,10 +148,3 @@ final class HooperClass extends HelperClass
|
||||
// nada
|
||||
}
|
||||
}
|
||||
|
||||
class PooperClass
|
||||
{
|
||||
public function PooperClass ()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user