Added an extra step to the datagram negotation process. Before

the server starts sending datagrams willy-nilly, it must wait for 
a (reliable) go-ahead from the client.  Otherwise, it's possible 
that the server may be successfully receiving datagrams but not 
sending them.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5792 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Andrzej Kapolka
2009-05-21 04:16:41 +00:00
parent 0f70a5c8d2
commit 6dd16483be
5 changed files with 75 additions and 3 deletions
@@ -63,6 +63,7 @@ import com.threerings.presents.net.PingRequest;
import com.threerings.presents.net.PongResponse;
import com.threerings.presents.net.SubscribeRequest;
import com.threerings.presents.net.ThrottleUpdatedMessage;
import com.threerings.presents.net.TransmitDatagramsRequest;
import com.threerings.presents.net.UnsubscribeRequest;
import com.threerings.presents.net.UnsubscribeResponse;
import com.threerings.presents.net.UpdateThrottleMessage;
@@ -1085,6 +1086,18 @@ public class PresentsSession
}
}
/**
* Processes datagram transmission requests.
*/
protected static class TransmitDatagramsDispatcher implements MessageDispatcher
{
public void dispatch (PresentsSession client, Message msg)
{
log.debug("Client requested datagram transmission", "client", client);
client.getConnection().setTransmitDatagrams(true);
}
}
/**
* Processes throttle updated messages.
*/
@@ -1158,6 +1171,7 @@ public class PresentsSession
_disps.put(UnsubscribeRequest.class, new UnsubscribeDispatcher());
_disps.put(ForwardEventRequest.class, new ForwardEventDispatcher());
_disps.put(PingRequest.class, new PingDispatcher());
_disps.put(TransmitDatagramsRequest.class, new TransmitDatagramsDispatcher());
_disps.put(ThrottleUpdatedMessage.class, new ThrottleUpdatedDispatcher());
_disps.put(LogoffRequest.class, new LogoffDispatcher());
}