Represents a network connection map. More...
Classes | |
struct | Iterator |
Iterator for traversing the connections in a NetConnectionMap . More... | |
Public Types | |
enum class | EntryState |
Represents the state of an entry in the NetConnectionMap . More... | |
Public Member Functions | |
NetConnection * | Find (NetAddress address) |
Finds a connection by its address in the network peer group. More... | |
NetConnection * | Find (NetConnectionId id) |
Finds a connection by its ID in the network peer group. More... | |
NetConnection * | FindByIndex (int index) |
Gets a connection by its index in the network peer group. More... | |
NetConnection * | Insert (NetAddress address, byte[] uniqueId) |
Inserts a new connection into the network peer group using the specified address and unique ID. More... | |
NetConnection * | Remap (NetAddress oldAddress, NetAddress newAddress) |
Remaps a connection from an old address to a new address. More... | |
bool | Remove (NetAddress address) |
Removes a connection from the network peer group by its address. More... | |
bool | TryFindByIndex (int index, out NetConnection *connection) |
Tries to get a connection by its index in the network peer group. More... | |
Static Public Member Functions | |
static NetConnectionMap * | Allocate (int capacity, short groupIndex, in NetConfig *config) |
Allocates and initializes a new NetConnectionMap with the specified capacity and group index. More... | |
static void | Dispose (NetConnectionMap *map, INetPeerGroupCallbacks callbacks) |
Disposes of the specified NetConnectionMap and its associated resources. More... | |
Public Attributes | |
NetConnection ** | Buckets |
ulong | CapacityAllocated |
ulong | FreeCount |
NetConnection * | FreeHead |
short | Group |
ulong | IdsCount |
UniqueIdMapping * | UniqueIdHashes |
ulong | UsedCount |
Properties | |
NetConnection * | ConnectionsBuffer [get] |
Gets the buffer of connections. More... | |
int | Count [get] |
Gets the count of used connections minus the free connections. More... | |
int | CountUsed [get] |
Gets the count of used connections. More... | |
bool | Full [get] |
Gets a value indicating whether the connection map is full. More... | |
Represents a network connection map.
|
strong |
Represents the state of an entry in the NetConnectionMap
.
Enumerator | |
---|---|
None | The entry is not in use. |
Free | The entry is free and available for use. |
Used | The entry is currently in use. |
|
static |
Allocates and initializes a new NetConnectionMap
with the specified capacity and group index.
capacity | The number of connections the map can hold. |
groupIndex | The group index associated with the connections. |
config | The configuration settings for the network connections. |
NetConnectionMap
.
|
static |
Disposes of the specified NetConnectionMap
and its associated resources.
map | A pointer to the NetConnectionMap to dispose. |
callbacks | The callbacks to invoke during disposal. |
NetConnection* Find | ( | NetAddress | address | ) |
Finds a connection by its address in the network peer group.
address | The address of the connection to find. |
NetConnection* Find | ( | NetConnectionId | id | ) |
Finds a connection by its ID in the network peer group.
id | The ID of the connection to find. |
NetConnection* FindByIndex | ( | int | index | ) |
Gets a connection by its index in the network peer group.
index | The index of the connection to retrieve. |
IndexOutOfRangeException | Thrown when the index is out of the usable capacity range. |
NetConnection* Insert | ( | NetAddress | address, |
byte[] | uniqueId | ||
) |
Inserts a new connection into the network peer group using the specified address and unique ID.
address | The address of the connection to insert. |
uniqueId | The unique ID of the connection to insert. |
NetConnection* Remap | ( | NetAddress | oldAddress, |
NetAddress | newAddress | ||
) |
Remaps a connection from an old address to a new address.
oldAddress | The old address of the connection. |
newAddress | The new address of the connection. |
bool Remove | ( | NetAddress | address | ) |
Removes a connection from the network peer group by its address.
address | The address of the connection to remove. |
bool TryFindByIndex | ( | int | index, |
out NetConnection * | connection | ||
) |
Tries to get a connection by its index in the network peer group.
index | The index of the connection to retrieve. |
connection | Output parameter that will point to the connection if found. |
|
get |
Gets the buffer of connections.
|
get |
Gets the count of used connections minus the free connections.
|
get |
Gets the count of used connections.
|
get |
Gets a value indicating whether the connection map is full.