Every byte is precious!

No need to tell the server the callerOid, it already knows it.
This saves 4 bytes for every listener you pass into an invocation request.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5908 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2009-08-13 19:15:21 +00:00
parent 8284198e57
commit 7489a64555
5 changed files with 5 additions and 11 deletions
@@ -190,7 +190,6 @@ public class InvocationDirector
if (arg is InvocationMarshaller_ListenerMarshaller) { if (arg is InvocationMarshaller_ListenerMarshaller) {
var lm :InvocationMarshaller_ListenerMarshaller = var lm :InvocationMarshaller_ListenerMarshaller =
(arg as InvocationMarshaller_ListenerMarshaller); (arg as InvocationMarshaller_ListenerMarshaller);
lm.callerOid = _clobj.getOid();
lm.requestId = nextRequestId(); lm.requestId = nextRequestId();
lm.mapStamp = getTimer(); lm.mapStamp = getTimer();
@@ -36,9 +36,6 @@ public class InvocationMarshaller_ListenerMarshaller
/** The method id used to dispatch a requestFailed response. */ /** The method id used to dispatch a requestFailed response. */
public static const REQUEST_FAILED_RSPID :int = 0; public static const REQUEST_FAILED_RSPID :int = 0;
/** The oid of the invocation service requester. */
public var callerOid :int;
/** The request id associated with this listener. */ /** The request id associated with this listener. */
public var requestId :int; public var requestId :int;
@@ -70,14 +67,12 @@ public class InvocationMarshaller_ListenerMarshaller
*/ */
public function toString () :String public function toString () :String
{ {
return "[callerOid=" + callerOid + ", reqId=" + requestId + return "[reqId=" + requestId + ", type=" + ClassUtil.getClassName(this) + "]";
", type=" + ClassUtil.getClassName(this) + "]";
} }
// documentation inherited from interface Streamable // documentation inherited from interface Streamable
public function writeObject (out :ObjectOutputStream) :void public function writeObject (out :ObjectOutputStream) :void
{ {
out.writeInt(callerOid);
out.writeShort(requestId); out.writeShort(requestId);
} }
@@ -218,7 +218,6 @@ public class InvocationDirector
Object arg = args[ii]; Object arg = args[ii];
if (arg instanceof ListenerMarshaller) { if (arg instanceof ListenerMarshaller) {
ListenerMarshaller lm = (ListenerMarshaller)arg; ListenerMarshaller lm = (ListenerMarshaller)arg;
lm.callerOid = _clobj.getOid();
lm.requestId = nextRequestId(); lm.requestId = nextRequestId();
lm.mapStamp = System.currentTimeMillis(); lm.mapStamp = System.currentTimeMillis();
// create a mapping for this marshaller so that we can properly dispatch responses // create a mapping for this marshaller so that we can properly dispatch responses
@@ -47,12 +47,12 @@ public class InvocationMarshaller
/** The method id used to dispatch a {@link #requestFailed} response. */ /** The method id used to dispatch a {@link #requestFailed} response. */
public static final int REQUEST_FAILED_RSPID = 0; public static final int REQUEST_FAILED_RSPID = 0;
/** The oid of the invocation service requester. */
public int callerOid;
/** The request id associated with this listener. */ /** The request id associated with this listener. */
public short requestId; public short requestId;
/** The oid of the invocation service requester. Only used on the server. */
public transient int callerOid;
/** The actual invocation listener associated with this marshalling listener. This is only /** The actual invocation listener associated with this marshalling listener. This is only
* valid on the client. */ * valid on the client. */
public transient InvocationListener listener; public transient InvocationListener listener;
@@ -245,6 +245,7 @@ public class InvocationManager
Object arg = args[ii]; Object arg = args[ii];
if (arg instanceof ListenerMarshaller) { if (arg instanceof ListenerMarshaller) {
ListenerMarshaller list = (ListenerMarshaller)arg; ListenerMarshaller list = (ListenerMarshaller)arg;
list.callerOid = clientOid;
list.omgr = _omgr; list.omgr = _omgr;
list.transport = transport; list.transport = transport;
// keep track of the listener we'll inform if anything // keep track of the listener we'll inform if anything