Skip to main content

QueuedConnectionReceiver

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​

MemberWhat it is
protected QueuedConnectionReceiver(Connection connection, ConnectionChannel channel)Creates a QueuedConnectionReceiver from connection and channel.

Fields​

MemberWhat it is
protected bool isQueueingThisFrameSet when processing stopped part way this frame.
protected int messagesProcessedThisFrameMessages processed since the last ProcessExistingQueues.
1 private and internal field
MemberWhat it is
private readonly Queue<PooledDataQueueItem> incomingQueuePackets (or the unprocessed rest of them) waiting to be handled by ProcessExistingQueues.

Properties​

MemberWhat it is
bool HasQueue { get; }True when packets are waiting to be processed.

Events​

MemberWhat it is
event Action FinishedQueueRaised after each ProcessExistingQueues pass.

Methods​

MemberWhat 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
MemberWhat 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: