Created ServerCommunicator which does all I/O using the ConnectionManager's

polled socket system. This much more cleanly and efficiently integrates peer
(and other server to server) connections into the normal server I/O framework
and should also eliminate for good the annoying server hangs that result when
our old blocking client I/O threads got their pants wedged.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5510 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2008-11-07 00:27:07 +00:00
parent b81ccde75b
commit 89f02fc728
16 changed files with 777 additions and 594 deletions
@@ -22,16 +22,15 @@
package com.threerings.presents.net;
/**
* This class encapsulates a message in the distributed object protocol
* that flows from the server to the client. Downstream messages include
* object subscription, event forwarding and session management.
* This class encapsulates a message in the distributed object protocol that flows from the server
* to the client. Downstream messages include object subscription, event forwarding and session
* management.
*/
public abstract class DownstreamMessage extends Message
{
/**
* The message id of the upstream message with which this downstream
* message is associated (or -1 if it is not associated with any
* upstream message).
* The message id of the upstream message with which this downstream message is associated (or
* -1 if it is not associated with any upstream message).
*/
public short messageId = -1;
@@ -28,6 +28,9 @@ import com.threerings.io.SimpleStreamableObject;
*/
public abstract class Message extends SimpleStreamableObject
{
/** A timestamp indicating when this message was received from the network. */
public transient long received;
/**
* Sets the message transport parameters. For messages received over the network, these
* describe the mode of transport over which the message was received. When sending messages,
@@ -22,27 +22,22 @@
package com.threerings.presents.net;
/**
* This class encapsulates a message in the distributed object protocol
* that flows from the client to the server. Upstream messages include
* object subscription, event forwarding and session management.
* This class encapsulates a message in the distributed object protocol that flows from the client
* to the server. Upstream messages include object subscription, event forwarding and session
* management.
*/
public abstract class UpstreamMessage extends Message
{
/**
* This is a unique (within the context of a reasonable period of
* time) identifier assigned to each upstream message. The message ids
* are used to correlate a downstream response message to the
* appropriate upstream request message.
* This is a unique (within the context of a reasonable period of time) identifier assigned to
* each upstream message. The message ids are used to correlate a downstream response message
* to the appropriate upstream request message.
*/
public short messageId;
/** A timestamp indicating when this upstream message was received. */
public transient long received;
/**
* Each upstream message derived class must provide a zero argument
* constructor so that it can be unserialized when read from the
* network.
* Each upstream message derived class must provide a zero argument constructor so that it can
* be unserialized when read from the network.
*/
public UpstreamMessage ()
{
@@ -59,8 +54,7 @@ public abstract class UpstreamMessage extends Message
}
/**
* Returns the next message id suitable for use by an upstream
* message.
* Returns the next message id suitable for use by an upstream message.
*/
protected static synchronized short nextMessageId ()
{
@@ -69,8 +63,8 @@ public abstract class UpstreamMessage extends Message
}
/**
* This is used to generate monotonically increasing message ids on
* the client as new messages are generated.
* This is used to generate monotonically increasing message ids on the client as new messages
* are generated.
*/
protected static short _nextMessageId;
}