Table of Contents

Class NamingReplyBatches<TConnection>

Namespace
FishMMO.Server.Core.World.SceneServer
Assembly
FishMMO.Server.dll

Batched name answers grouped by the connection they go to, then split into replies of at most a given size. Reusable; main thread only.

public sealed class NamingReplyBatches<TConnection>

Type Parameters

TConnection

The connection type.

Inheritance
NamingReplyBatches<TConnection>
Inherited Members

Remarks

One lookup can finish for many connections at once, and one connection can be waiting on many of its IDs. Each connection is sent one reply per maxEntries answers, not one message per ID.

Properties

ConnectionCount

Connections with at least one answer queued.

public int ConnectionCount { get; }

Property Value

int

Methods

Add(TConnection, long, string)

Queues one answer for a connection.

public void Add(TConnection connection, long id, string name)

Parameters

connection TConnection

Who receives it.

id long

The ID answered.

name string

Its name, or empty for "no such entity".

Clear()

Drops every queued answer.

public void Clear()

Drain(int, Action<TConnection, long[], string[]>)

Hands every queued answer to send, at most maxEntries per call, connection by connection in the order they were first added; then empties.

public void Drain(int maxEntries, Action<TConnection, long[], string[]> send)

Parameters

maxEntries int

Most answers in one reply.

send Action<TConnection, long[], string[]>

Sends one reply: the connection, its IDs, and the parallel names.