Note the actual transport with which events are transmitted.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5794 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -152,6 +152,23 @@ public abstract class DEvent implements Streamable
|
|||||||
return _transport;
|
return _transport;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes the actual transport with which the event was transmitted.
|
||||||
|
*/
|
||||||
|
public void noteActualTransport (Transport transport)
|
||||||
|
{
|
||||||
|
_actualTransport = transport;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the actual transport with which the event was transmitted, or <code>null</code> if
|
||||||
|
* not yet known.
|
||||||
|
*/
|
||||||
|
public Transport getActualTransport ()
|
||||||
|
{
|
||||||
|
return _actualTransport;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Events with associated listener interfaces should implement this function and notify the
|
* Events with associated listener interfaces should implement this function and notify the
|
||||||
* supplied listener if it implements their event listening interface. For example, the {@link
|
* supplied listener if it implements their event listening interface. For example, the {@link
|
||||||
@@ -195,6 +212,9 @@ public abstract class DEvent implements Streamable
|
|||||||
/** The transport parameters. */
|
/** The transport parameters. */
|
||||||
protected transient Transport _transport = Transport.DEFAULT;
|
protected transient Transport _transport = Transport.DEFAULT;
|
||||||
|
|
||||||
|
/** The actual transport with which the event was transmitted (null if as yet unknown). */
|
||||||
|
protected transient Transport _actualTransport;
|
||||||
|
|
||||||
/** Used to differentiate between null meaning we haven't initialized our old value and null
|
/** Used to differentiate between null meaning we haven't initialized our old value and null
|
||||||
* being the actual old value. */
|
* being the actual old value. */
|
||||||
protected static final Object UNSET_OLD_VALUE = new Object();
|
protected static final Object UNSET_OLD_VALUE = new Object();
|
||||||
|
|||||||
@@ -62,6 +62,12 @@ public class EventNotification extends DownstreamMessage
|
|||||||
return _event.getTransport();
|
return _event.getTransport();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override // documentation inherited
|
||||||
|
public void noteActualTransport (Transport transport)
|
||||||
|
{
|
||||||
|
_event.noteActualTransport(transport);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString ()
|
public String toString ()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -50,4 +50,14 @@ public abstract class Message extends SimpleStreamableObject
|
|||||||
{
|
{
|
||||||
return Transport.DEFAULT;
|
return Transport.DEFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For messages sent over the network, this notes the actual type of transport used to deliver
|
||||||
|
* the message. This may not be the same as the hinted transport for various reasons (message
|
||||||
|
* too large to send as datagram, no datagram connection established, etc.)
|
||||||
|
*/
|
||||||
|
public void noteActualTransport (Transport transport)
|
||||||
|
{
|
||||||
|
// no-op by default
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ import com.threerings.presents.client.Client;
|
|||||||
import com.threerings.presents.data.ConMgrStats;
|
import com.threerings.presents.data.ConMgrStats;
|
||||||
import com.threerings.presents.net.Message;
|
import com.threerings.presents.net.Message;
|
||||||
import com.threerings.presents.net.PongResponse;
|
import com.threerings.presents.net.PongResponse;
|
||||||
|
import com.threerings.presents.net.Transport;
|
||||||
import com.threerings.presents.server.Authenticator;
|
import com.threerings.presents.server.Authenticator;
|
||||||
import com.threerings.presents.server.ChainedAuthenticator;
|
import com.threerings.presents.server.ChainedAuthenticator;
|
||||||
import com.threerings.presents.server.ClientManager;
|
import com.threerings.presents.server.ClientManager;
|
||||||
@@ -923,6 +924,9 @@ public class ConnectionManager extends LoopingThread
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// note the actual transport
|
||||||
|
msg.noteActualTransport(Transport.RELIABLE_ORDERED);
|
||||||
|
|
||||||
_framer.resetFrame();
|
_framer.resetFrame();
|
||||||
|
|
||||||
// flatten this message using the connection's output stream
|
// flatten this message using the connection's output stream
|
||||||
@@ -963,6 +967,9 @@ public class ConnectionManager extends LoopingThread
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// note the actual transport
|
||||||
|
msg.noteActualTransport(Transport.UNRELIABLE_UNORDERED);
|
||||||
|
|
||||||
// extract as a byte array
|
// extract as a byte array
|
||||||
byte[] data = _flattener.toByteArray();
|
byte[] data = _flattener.toByteArray();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user