MessageProcessor
A static class in Root.Township, Alta.Networking.Internal.
Reads single messages out of received packet data and runs the connection's handler for each message type. Used by the connection receivers on both sides.
- Listed in Networking and servers
Fields
| Member | What it is |
|---|---|
static Logger MessageLogger | The MessageDebug logger that traces every message read and written. |
6 private and internal fields
| Member | What it is |
|---|---|
private static Logger logger | NLog logger for errors. |
private static StreamReader messageReader | Shared reader over receiveBuffer. |
private static readonly uint[] receiveBuffer | Shared buffer the message bytes are copied into before reading. |
private const int receiveBufferSize | Length of receiveBuffer (2048 entries). |
private static readonly ushort[] size | One-entry buffer the length prefix is copied into. |
private const int UShortByteSize | Size of the length prefix, 2 bytes. |
Methods
| Member | What it is |
|---|---|
static int ProcessSingleMessageFromData(Connection connection, ArraySegment<byte> data, ConnectionChannel channel, out MessageType messageType) | Reads a 2 byte length, then one message with a 5 bit type, handles it and returns the bytes used. |
1 private and internal method
| Member | What it is |
|---|---|
private static bool HandleMessage(Connection connection, Stream stream, MessageType type, ConnectionChannel channel) | Finds the connection's handler for the message type and runs it, logging unsupported types and handler exceptions. |