Skip to main content

TimedQueuedConnectionReceiver

A class in Root.Township, Alta.Networking.Internal.

Client connection receiver that spends a time budget per frame on messages and queues the rest, to keep the frame rate up. Queues everything until the local player is set.

Constructors​

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

Fields​

4 private and internal fields
MemberWhat it is
private bool isReadyTrue once the local player has been set.
private readonly Stopwatch processedMessagesDurationStopwatch used to time each message.
private float processingAllowanceRemaining time budget in milliseconds.
private readonly ConnectionReceiveSettings settingsThe global ConnectionReceiveSettings.

Methods​

MemberWhat it is
override void ProcessExistingQueues()Adds to the time budget from the frame time and settings (capped), then works through the queue.
protected override bool ProcessReceivedPacket(ArraySegment<byte> data, out int progressed)Handles messages from a packet while budget remains, timing each one; returns true if the packet was finished.
protected override bool ShouldPacketBeQueued()Queues if not ready or the budget is below MinAllowanceToProcess; never queues while RenderLock is locked.
1 private and internal method
MemberWhat it is
private void HandleSceneSync(IPlayer player)When the local player is set, marks the receiver ready so messages start being handled.