OpenSim
|
Tracks state for a client UDP connection and provides client-specific methods More...
Public Member Functions | |
LLUDPClient (LLUDPServer server, ThrottleRates rates, TokenBucket parentThrottle, uint circuitCode, UUID agentID, IPEndPoint remoteEndPoint, int defaultRTO, int maxRTO) | |
Default constructor More... | |
void | Shutdown () |
Shuts down this client connection More... | |
ClientInfo | GetClientInfo () |
Gets information about this client connection More... | |
void | SetClientInfo (ClientInfo info) |
Modifies the UDP throttles More... | |
int | GetTotalPacketsQueuedCount () |
Get the total number of pakcets queued for this client. More... | |
int | GetPacketsQueuedCount (ThrottleOutPacketType throttleType) |
Get the number of packets queued for the given throttle type. More... | |
string | GetStats () |
Return statistics information about client packet queues. More... | |
void | SendPacketStats () |
void | SetThrottles (byte[] throttleData) |
void | SetThrottles (byte[] throttleData, float factor) |
byte[] | GetThrottlesPacked (float multiplier) |
int | GetCatBytesCanSend (ThrottleOutPacketType cat, int timeMS) |
bool | EnqueueOutgoing (OutgoingPacket packet, bool forceQueue) |
Queue an outgoing packet if appropriate. More... | |
bool | EnqueueOutgoing (OutgoingPacket packet, bool forceQueue, bool highPriority) |
bool | DequeueOutgoing () |
Loops through all of the packet queues for this client and tries to send an outgoing packet from each, obeying the throttling bucket limits More... | |
void | UpdateRoundTrip (float r) |
Called when an ACK packet is received and a round-trip time for a packet is calculated. This is used to calculate the smoothed round-trip time, round trip time variance, and finally the retransmission timeout More... | |
void | BackoffRTO () |
Exponential backoff of the retransmission timeout, per section 5.5 of RFC 2988 More... | |
void | FireQueueEmpty (object o) |
Fires the OnQueueEmpty callback and sets the minimum time that it can be called again More... | |
Public Attributes | |
readonly UUID | AgentID |
AgentID for this client More... | |
readonly IPEndPoint | RemoteEndPoint |
The remote address of the connected client More... | |
readonly uint | CircuitCode |
Circuit code that this client is connected on More... | |
readonly IncomingPacketHistoryCollection | PacketArchive = new IncomingPacketHistoryCollection(200) |
Sequence numbers of packets we've received (for duplicate checking) More... | |
readonly UnackedPacketCollection | NeedAcks = new UnackedPacketCollection() |
Packets we have sent that need to be ACKed by the client More... | |
readonly DoubleLocklessQueue < uint > | PendingAcks = new DoubleLocklessQueue<uint>() |
ACKs that are queued up, waiting to be sent to the client More... | |
int | CurrentSequence |
Current packet sequence number More... | |
byte | CurrentPingSequence |
Current ping sequence number More... | |
bool | IsConnected = true |
True when this connection is alive, otherwise false More... | |
bool | IsPaused |
True when this connection is paused, otherwise false More... | |
int | TickLastPacketReceived |
Environment.TickCount when the last packet was received for this client More... | |
float | SRTT |
Smoothed round-trip time. A smoothed average of the round-trip time for sending a reliable packet to the client and receiving an ACK More... | |
float | RTTVAR |
Round-trip time variance. Measures the consistency of round-trip times More... | |
int | RTO |
Retransmission timeout. Packets that have not been acknowledged in this number of milliseconds or longer will be resent More... | |
int | BytesSinceLastACK |
Number of bytes received since the last acknowledgement was sent out. This is used to loosely follow the TCP delayed ACK algorithm in RFC 1122 (4.2.3.2) More... | |
int | PacketsReceived |
Number of packets received from this client More... | |
int | PacketsSent |
Number of packets sent to this client More... | |
int | PacketsResent |
Number of packets resent to this client More... | |
int | UnackedBytes |
Total byte count of unacked packets sent to this client More... | |
bool | m_deliverPackets = true |
int | m_lastStartpingTimeMS |
int | m_pingMS |
Properties | |
int | DebugDataOutLevel [get, set] |
Controls whether information is logged about each outbound packet immediately before it is sent. For debug purposes. More... | |
int | ThrottleDebugLevel [get, set] |
Controls whether information is logged about each outbound packet immediately before it is sent. For debug purposes. More... | |
AdaptiveTokenBucket | FlowThrottle [get] |
int | PingTimeMS [get] |
Events | |
PacketStats | OnPacketStats |
Fired when updated networking stats are produced for this client More... | |
QueueEmpty | OnQueueEmpty |
Fired when the queue for a packet category is empty. This event can be hooked to put more data on the empty queue More... | |
Func < ThrottleOutPacketTypeFlags, bool > | HasUpdates |
Tracks state for a client UDP connection and provides client-specific methods
Definition at line 66 of file LLUDPClient.cs.
|
inline |
Default constructor
server | Reference to the UDP server this client is connected to |
rates | Default throttling rates and maximum throttle limits |
parentThrottle | Parent HTB (hierarchical token bucket) that the child throttles will be governed by |
circuitCode | Circuit code for this connection |
agentID | AgentID for the connected agent |
remoteEndPoint | Remote endpoint for this connection |
defaultRTO | Default retransmission timeout for unacked packets. The RTO will never drop beyond this number. |
maxRTO | The maximum retransmission timeout for unacked packets. The RTO will never exceed this number. |
Definition at line 237 of file LLUDPClient.cs.
|
inline |
Exponential backoff of the retransmission timeout, per section 5.5 of RFC 2988
Definition at line 763 of file LLUDPClient.cs.
|
inline |
Loops through all of the packet queues for this client and tries to send an outgoing packet from each, obeying the throttling bucket limits
Packet queues are inspected in ascending numerical order starting from 0. Therefore, queues with a lower ThrottleOutPacketType number will see their packet get sent first (e.g. if both Land and Wind queues have packets, then the packet at the front of the Land queue will be sent before the packet at the front of the wind queue).
This function is only called from a synchronous loop in the UDPServer so we don't need to bother making this thread safe
Definition at line 628 of file LLUDPClient.cs.
|
inline |
Queue an outgoing packet if appropriate.
packet | |
forceQueue | Always queue the packet if at all possible. |
Definition at line 563 of file LLUDPClient.cs.
|
inline |
|
inline |
Fires the OnQueueEmpty callback and sets the minimum time that it can be called again
o | Throttle categories to fire the callback for, stored as an object to match the WaitCallback delegate signature |
Definition at line 826 of file LLUDPClient.cs.
|
inline |
Definition at line 542 of file LLUDPClient.cs.
|
inline |
Gets information about this client connection
Definition at line 303 of file LLUDPClient.cs.
|
inline |
Get the number of packets queued for the given throttle type.
throttleType |
Definition at line 351 of file LLUDPClient.cs.
|
inline |
Return statistics information about client packet queues.
FIXME: This should really be done in a more sensible manner rather than sending back a formatted string.
Definition at line 367 of file LLUDPClient.cs.
|
inline |
Definition at line 501 of file LLUDPClient.cs.
|
inline |
Get the total number of pakcets queued for this client.
Definition at line 336 of file LLUDPClient.cs.
|
inline |
Definition at line 385 of file LLUDPClient.cs.
|
inline |
Modifies the UDP throttles
info | New throttling values |
Definition at line 324 of file LLUDPClient.cs.
|
inline |
Definition at line 400 of file LLUDPClient.cs.
|
inline |
Definition at line 405 of file LLUDPClient.cs.
|
inline |
Shuts down this client connection
Definition at line 284 of file LLUDPClient.cs.
|
inline |
Called when an ACK packet is received and a round-trip time for a packet is calculated. This is used to calculate the smoothed round-trip time, round trip time variance, and finally the retransmission timeout
r | Round-trip time of a single packet and its acknowledgement |
Definition at line 728 of file LLUDPClient.cs.
readonly UUID OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.AgentID |
AgentID for this client
Definition at line 117 of file LLUDPClient.cs.
int OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.BytesSinceLastACK |
Number of bytes received since the last acknowledgement was sent out. This is used to loosely follow the TCP delayed ACK algorithm in RFC 1122 (4.2.3.2)
Definition at line 154 of file LLUDPClient.cs.
readonly uint OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.CircuitCode |
Circuit code that this client is connected on
Definition at line 121 of file LLUDPClient.cs.
byte OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.CurrentPingSequence |
Current ping sequence number
Definition at line 134 of file LLUDPClient.cs.
int OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.CurrentSequence |
Current packet sequence number
Definition at line 132 of file LLUDPClient.cs.
bool OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.IsConnected = true |
True when this connection is alive, otherwise false
Definition at line 136 of file LLUDPClient.cs.
bool OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.IsPaused |
True when this connection is paused, otherwise false
Definition at line 138 of file LLUDPClient.cs.
bool OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.m_deliverPackets = true |
Definition at line 193 of file LLUDPClient.cs.
int OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.m_lastStartpingTimeMS |
Definition at line 197 of file LLUDPClient.cs.
int OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.m_pingMS |
Definition at line 198 of file LLUDPClient.cs.
readonly UnackedPacketCollection OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.NeedAcks = new UnackedPacketCollection() |
Packets we have sent that need to be ACKed by the client
Definition at line 126 of file LLUDPClient.cs.
readonly IncomingPacketHistoryCollection OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.PacketArchive = new IncomingPacketHistoryCollection(200) |
Sequence numbers of packets we've received (for duplicate checking)
Definition at line 123 of file LLUDPClient.cs.
int OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.PacketsReceived |
Number of packets received from this client
Definition at line 156 of file LLUDPClient.cs.
int OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.PacketsResent |
Number of packets resent to this client
Definition at line 160 of file LLUDPClient.cs.
int OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.PacketsSent |
Number of packets sent to this client
Definition at line 158 of file LLUDPClient.cs.
readonly DoubleLocklessQueue<uint> OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.PendingAcks = new DoubleLocklessQueue<uint>() |
ACKs that are queued up, waiting to be sent to the client
Definition at line 129 of file LLUDPClient.cs.
readonly IPEndPoint OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.RemoteEndPoint |
The remote address of the connected client
Definition at line 119 of file LLUDPClient.cs.
int OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.RTO |
Retransmission timeout. Packets that have not been acknowledged in this number of milliseconds or longer will be resent
Calculated from
and using the guidelines in RFC 2988
Definition at line 151 of file LLUDPClient.cs.
float OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.RTTVAR |
Round-trip time variance. Measures the consistency of round-trip times
Definition at line 146 of file LLUDPClient.cs.
float OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.SRTT |
Smoothed round-trip time. A smoothed average of the round-trip time for sending a reliable packet to the client and receiving an ACK
Definition at line 144 of file LLUDPClient.cs.
int OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.TickLastPacketReceived |
Environment.TickCount when the last packet was received for this client
Definition at line 140 of file LLUDPClient.cs.
int OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.UnackedBytes |
Total byte count of unacked packets sent to this client
Definition at line 162 of file LLUDPClient.cs.
|
getset |
Controls whether information is logged about each outbound packet immediately before it is sent. For debug purposes.
Any level above 0 will turn on logging.
Definition at line 83 of file LLUDPClient.cs.
|
get |
Definition at line 174 of file LLUDPClient.cs.
|
get |
Definition at line 201 of file LLUDPClient.cs.
|
getset |
Controls whether information is logged about each outbound packet immediately before it is sent. For debug purposes.
Any level above 0 will turn on logging.
Definition at line 90 of file LLUDPClient.cs.
Func<ThrottleOutPacketTypeFlags, bool> OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.HasUpdates |
Definition at line 114 of file LLUDPClient.cs.
PacketStats OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.OnPacketStats |
Fired when updated networking stats are produced for this client
Definition at line 109 of file LLUDPClient.cs.
QueueEmpty OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.OnQueueEmpty |
Fired when the queue for a packet category is empty. This event can be hooked to put more data on the empty queue
Definition at line 112 of file LLUDPClient.cs.