ServerMessageReceiverPerConnection
A class in Root.Township, Alta.Networking.
Server: per-connection receiver that holds incoming unreliable packets until the frame's processing step and handles connect and disconnect events. Made by ServerPacketReceiver.
- Listed in Networking and servers
Constructors
| Member | What it is |
|---|---|
ServerMessageReceiverPerConnection(int connectionIdentifier, ISocket socket) | Creates a ServerMessageReceiverPerConnection from connectionIdentifier and socket. |
Fields
9 private and internal fields
| Member | What it is |
|---|---|
private Connection connection | The game Connection for this transport connection, once connected. |
private int connectionIdentifier | Transport connection id. |
private bool isLoggingOnUnknownReceive | Whether the next unknown receive should still be logged. |
private static Logger logger | Logger for connection events and receive errors. |
private ISocket socket | The socket that creates the connection. |
private ArraySegment<byte>[] unreliableBuffers | Ring buffer of unreliable packets waiting for this frame. |
private int unreliableIndex | Next write slot in the ring buffer. |
private int unreliableLength | Ring buffer size. |
private int unreliableReceivedCount | Unreliable packets received since the last ProcessUnreliable. |
Methods
| Member | What it is |
|---|---|
void HandleConnectionEvent(ITransportConnection transportConnection) | Creates the Connection on first connect (or reuses it) and approves it. |
void HandleDisconnectEvent() | Disconnects the connection, or logs an error if none is known. |
int ProcessUnreliable() | Processes the buffered unreliable packets, oldest first, and returns how many arrived (including dropped ones). |
void ReceiveUnreliable(ArraySegment<byte> data) | Stores an unreliable packet in the ring buffer, overwriting the oldest when full. |
3 private and internal methods
| Member | What it is |
|---|---|
private void InitializeBuffers() | Makes the ring buffer, sized by NetworkingSettings.MaxUnreliableReceivedPerFrame. |
private void LogUnknownReceive() | Logs once when data arrives before a connect event. |
private void ProcessMessage(ArraySegment<byte> message, bool isReliable) | Passes a packet to the connection, logging fatal errors instead of throwing. |
Used in
Members of other types that take, return or hold a ServerMessageReceiverPerConnection: