An abstract class in Root.Township, Alta.Networking.Internal.
A connection receiver that can hold packets back and process them later, so incoming messages can be spread over frames. Subclasses decide when to queue.
Constructors
Fields
| Member | What it is |
|---|
protected bool isQueueingThisFrame | Set when processing stopped part way this frame. |
protected int messagesProcessedThisFrame | Messages processed since the last ProcessExistingQueues. |
1 private and internal field
| Member | What it is |
|---|
private readonly Queue<PooledDataQueueItem> incomingQueue | Packets (or the unprocessed rest of them) waiting to be handled by ProcessExistingQueues. |
Properties
| Member | What it is |
|---|
bool HasQueue { get; } | True when packets are waiting to be processed. |
Events
| Member | What it is |
|---|
event Action FinishedQueue | Raised after each ProcessExistingQueues pass. |
Methods
| Member | What it is |
|---|
override void Dispose() | Stops the receiver and releases any queued packets. |
override void ProcessExistingQueues() | Processes queued packets in order, stopping part way through one if processing has to pause. |
override void ReceivePacket(ITransportSocket socket, ArraySegment<byte> data) | Processes a packet straight away or queues it. Whatever is left of a part-processed packet is queued. |
protected virtual bool CanContinueProcessingPacket() | Whether to keep reading messages from the current packet. By default, while ShouldPacketBeQueued is false. |
protected virtual bool ProcessReceivedPacket(ArraySegment<byte> data, out int progress) | Processes messages in a packet one at a time. Returns false with the bytes used if it had to stop early. |
protected abstract bool ShouldPacketBeQueued() | Whether new packets should be queued instead of processed now. |
1 private and internal method
| Member | What it is |
|---|
private void QueuePacketData(ArraySegment<byte> data) | Wraps packet data in a pooled item and adds it to incomingQueue. |
Used in
Members of other types that take, return or hold a QueuedConnectionReceiver: