Allow downstream and upstream messages to be compounded
A client can collect a bunch of messages into a CompoundUpstreamMessage, which are unpacked and dispatched in order by the server. The server collects any messages sent while processing that compound message into a CompoundDownstreamMessage, which is unpacked and dispatched by the client. This allows the client to indicate that it's going to send enough messages that it'd blow out the throttle, but that it's doing so intentionally. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6659 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -20,7 +20,6 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
package com.threerings.presents.client {
|
||||
|
||||
import flash.events.EventDispatcher;
|
||||
import flash.events.TimerEvent;
|
||||
|
||||
@@ -280,6 +279,21 @@ public class Client extends EventDispatcher
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the given function while collecting any generated messages in a CompoundEvent, which
|
||||
* will be sent when the function returns.
|
||||
*/
|
||||
public function inCompoundMessage (run :Function) :void
|
||||
{
|
||||
_comm.startCompoundMessage();
|
||||
try {
|
||||
run();
|
||||
} finally {
|
||||
_comm.finishCompoundMessage();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the client property object to pass to {@link ObjectInputStream}. Subclasses may
|
||||
* add references useful during e.g. deserialization.
|
||||
|
||||
Reference in New Issue
Block a user