diff --git a/src/as/com/threerings/io/ObjectInputStream.as b/src/as/com/threerings/io/ObjectInputStream.as index 80ac0d23b..332597b19 100644 --- a/src/as/com/threerings/io/ObjectInputStream.as +++ b/src/as/com/threerings/io/ObjectInputStream.as @@ -38,12 +38,13 @@ public class ObjectInputStream public static const log :Log = Log.getLog(ObjectInputStream); - public function ObjectInputStream (source :IDataInput = null) + public function ObjectInputStream (source :IDataInput = null, clientProps :Object = null) { if (source == null) { source = new ByteArray(); } - _source = source; + _source = source || new ByteArray(); + _cliProps = clientProps || {}; } /** @@ -54,6 +55,15 @@ public class ObjectInputStream _source = source; } + /** + * Return a "client property" with the specified name. + * Actionscript only. + */ + public function getClientProperty (name :String) :* + { + return _cliProps[name]; + } + /** * Attempts to read the next object from the stream. If a type is passed and the read object's * type doesn't match, a TypeError is thrown. @@ -247,6 +257,9 @@ public class ObjectInputStream return _source.readUTF(); } + /** Named "client properties" that we can provide to deserialized objects. */ + protected var _cliProps :Object; + /** The target DataInput that we route input from. */ protected var _source :IDataInput; diff --git a/src/as/com/threerings/presents/client/Communicator.as b/src/as/com/threerings/presents/client/Communicator.as index 1b2e32f9d..1f791fc80 100644 --- a/src/as/com/threerings/presents/client/Communicator.as +++ b/src/as/com/threerings/presents/client/Communicator.as @@ -61,7 +61,7 @@ public class Communicator _outBuffer = new ByteArray(); _outBuffer.endian = Endian.BIG_ENDIAN; _outStream = new ObjectOutputStream(_outBuffer); - _inStream = new ObjectInputStream(); + _inStream = new ObjectInputStream(null, { invDir: _client.getInvocationDirector() }); attemptLogon(0); } diff --git a/src/as/com/threerings/presents/data/InvocationMarshaller.as b/src/as/com/threerings/presents/data/InvocationMarshaller.as index 5b343b898..6c4a04b92 100644 --- a/src/as/com/threerings/presents/data/InvocationMarshaller.as +++ b/src/as/com/threerings/presents/data/InvocationMarshaller.as @@ -28,6 +28,7 @@ import com.threerings.io.ObjectOutputStream; import com.threerings.io.Streamable; import com.threerings.presents.client.Client; +import com.threerings.presents.client.InvocationDirector; import com.threerings.presents.client.InvocationService; import com.threerings.presents.dobj.DObjectManager; @@ -73,11 +74,9 @@ public class InvocationMarshaller * Called by generated invocation marshaller code; packages up and * sends the specified invocation service request. */ - protected function sendRequest ( - client :Client, methodId :int, args :Array) :void + protected function sendRequest (methodId :int, args :Array) :void { - client.getInvocationDirector().sendRequest( - _invOid, _invCode, methodId, args); + _invDir.sendRequest(_invOid, _invCode, methodId, args); } /** @@ -101,6 +100,9 @@ public class InvocationMarshaller { _invOid = ins.readInt(); _invCode = ins.readInt(); + + // this is sorta hacky, but so is actionscript. + _invDir = ins.getClientProperty("invDir"); } /** The oid of the invocation object, where invocation service @@ -110,5 +112,8 @@ public class InvocationMarshaller /** The invocation service code assigned to this service when it was * registered on the server. */ protected var _invCode :int; + + /** The invocation director we use. */ + protected var _invDir :InvocationDirector; } } diff --git a/src/as/com/threerings/presents/data/InvocationMarshaller_ListenerMarshaller.as b/src/as/com/threerings/presents/data/InvocationMarshaller_ListenerMarshaller.as index fed59fb0f..8c567fe4d 100644 --- a/src/as/com/threerings/presents/data/InvocationMarshaller_ListenerMarshaller.as +++ b/src/as/com/threerings/presents/data/InvocationMarshaller_ListenerMarshaller.as @@ -60,10 +60,8 @@ public class InvocationMarshaller_ListenerMarshaller listener.requestFailed((args[0] as String)); } else { - Log.getLog(this).warning( - "Requested to dispatch unknown invocation response " + - "[listener=" + listener + ", methodId=" + methodId + - ", args=" + args + "]."); + Log.getLog(this).warning("Requested to dispatch unknown invocation response", + "listener", listener, "methodId", methodId, "args", args); } }