Struct PacketsQueue
A queue of packets with an internal pool of preallocated packet buffers.
Implements
Inherited Members
Namespace: Unity.Networking.Transport
Assembly: Unity.Networking.Transport.dll
Syntax
public struct PacketsQueue : IDisposableProperties
Capacity
Total capacity of the queue.
Declaration
public int Capacity { get; }Property Value
| Type | Description | 
|---|---|
| int | Capacity in number of packets. | 
Count
Number of packets currently in the queue.
Declaration
public int Count { get; }Property Value
| Type | Description | 
|---|---|
| int | Count in number of packets. | 
IsCreated
Whether the queue has been created or not.
Declaration
public bool IsCreated { get; }Property Value
| Type | Description | 
|---|---|
| bool | True if created, false otherwise. | 
this[int]
Gets the packet processor for the packet at the given index.
Declaration
public PacketProcessor this[int packetIndex] { get; }Parameters
| Type | Name | Description | 
|---|---|---|
| int | packetIndex | Index of the packet in the queue. | 
Property Value
| Type | Description | 
|---|---|
| PacketProcessor | Packet processor for the packet at the provided index. | 
Exceptions
| Type | Condition | 
|---|---|
| IndexOutOfRangeException | If the index is not valid. | 
Methods
Clear()
Removes and releases all the packets in the queue.
Declaration
public void Clear()Dispose()
Declaration
public void Dispose()EnqueuePacket(out PacketProcessor)
Acquires a new packet buffer from the packets pool if there are any available.
Declaration
public bool EnqueuePacket(out PacketProcessor packetProcessor)Parameters
| Type | Name | Description | 
|---|---|---|
| PacketProcessor | packetProcessor | Packet processor for the new packet. | 
Returns
| Type | Description | 
|---|---|
| bool | True if a new packet was enqueued, false otherwise. | 
EnqueuePackets(ref PacketsQueue)
Copies all the packets from the given queue into this one. Note that no error is raised if not all packets could be copied. It is the responsibility of the caller to ensure that the queue can fit all the packets from the given queue.
Declaration
public void EnqueuePackets(ref PacketsQueue originQueue)Parameters
| Type | Name | Description | 
|---|---|---|
| PacketsQueue | originQueue | Queue that contains the packets to enqueue. |