C# Класс Universe.ClientStack.UnackedPacketCollection

Special collection that is optimized for tracking unacknowledged packets
Показать файл Открыть проект

Открытые методы

Метод Описание
Acknowledge ( uint sequenceNumber, int currentTime, bool fromResend ) : void

Marks a packet as acknowledged This method is used when an acknowledgement is received from the network for a previously sent packet. Effects of removal this way are to update unacked byte count, adjust RTT and increase throttle to the corresponding client.

This does not immediately acknowledge the packet, it only queues the ack so it can be handled in a thread-safe way later

Add ( OutgoingPacket packet ) : void

Add an unacked packet to the collection

This does not immediately add the ACK to the collection, it only queues it so it can be added in a thread-safe way later

GetExpiredPackets ( int timeoutMS ) : List

Returns a list of all of the packets with a TickCount older than the specified timeout

This function is not thread safe, and cannot be called multiple times concurrently

Remove ( uint sequenceNumber ) : void

Marks a packet as no longer needing acknowledgement without a received acknowledgement. This method is called when a packet expires and we no longer need an acknowledgement. When some reliable packet types expire, they are handled in a way other than simply resending them. The only effect of removal this way is to update unacked byte count.

The does not immediately remove the packet, it only queues the removal so it can be handled in a thread safe way later

Приватные методы

Метод Описание
ProcessQueues ( ) : void

Описание методов

Acknowledge() публичный Метод

Marks a packet as acknowledged This method is used when an acknowledgement is received from the network for a previously sent packet. Effects of removal this way are to update unacked byte count, adjust RTT and increase throttle to the corresponding client.
This does not immediately acknowledge the packet, it only queues the ack so it can be handled in a thread-safe way later
public Acknowledge ( uint sequenceNumber, int currentTime, bool fromResend ) : void
sequenceNumber uint /// Sequence number of the packet to /// acknowledge ///
currentTime int Current value of Environment.TickCount
fromResend bool
Результат void

Add() публичный Метод

Add an unacked packet to the collection
This does not immediately add the ACK to the collection, it only queues it so it can be added in a thread-safe way later
public Add ( OutgoingPacket packet ) : void
packet OutgoingPacket Packet that is awaiting acknowledgement
Результат void

GetExpiredPackets() публичный Метод

Returns a list of all of the packets with a TickCount older than the specified timeout
This function is not thread safe, and cannot be called multiple times concurrently
public GetExpiredPackets ( int timeoutMS ) : List
timeoutMS int /// Number of ticks (milliseconds) before a /// packet is considered expired ///
Результат List

Remove() публичный Метод

Marks a packet as no longer needing acknowledgement without a received acknowledgement. This method is called when a packet expires and we no longer need an acknowledgement. When some reliable packet types expire, they are handled in a way other than simply resending them. The only effect of removal this way is to update unacked byte count.
The does not immediately remove the packet, it only queues the removal so it can be handled in a thread safe way later
public Remove ( uint sequenceNumber ) : void
sequenceNumber uint /// Sequence number of the packet to /// acknowledge ///
Результат void