Client side message throttling. The server is configured with a hard limit, it

communicates that limit to the client which queues outgoing messages so that it
does not exceed the limit. When the throttle is changed, the server does not
apply the new throttle until the client has ACKed it to avoid edge cases where
the client is up against the limit when the throttle changes.

ActionScript side of all of this forthcoming as well as more testing.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5422 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2008-10-08 19:38:00 +00:00
parent df42b4a013
commit 9c65e203b5
9 changed files with 206 additions and 306 deletions
@@ -704,6 +704,15 @@ public class BlockingCommunicator extends Communicator
return;
}
// make sure we're not exceeding our outgoing throttle rate
while (_client.getOutgoingMessageThrottle().throttleOp()) {
try {
Thread.sleep(2);
} catch (InterruptedException ie) {
// no problem
}
}
try {
// write the message out the socket
sendMessage(msg);