OpenSim
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Public Member Functions | Public Attributes | Properties | Events | List of all members
OpenSim.Region.ClientStack.LindenUDP.LLUDPClient Class Reference

Tracks state for a client UDP connection and provides client-specific methods More...

Collaboration diagram for OpenSim.Region.ClientStack.LindenUDP.LLUDPClient:
Collaboration graph
[legend]

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
 

Detailed Description

Tracks state for a client UDP connection and provides client-specific methods

Definition at line 66 of file LLUDPClient.cs.

Constructor & Destructor Documentation

OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.LLUDPClient ( LLUDPServer  server,
ThrottleRates  rates,
TokenBucket  parentThrottle,
uint  circuitCode,
UUID  agentID,
IPEndPoint  remoteEndPoint,
int  defaultRTO,
int  maxRTO 
)
inline

Default constructor

Parameters
serverReference to the UDP server this client is connected to
ratesDefault throttling rates and maximum throttle limits
parentThrottleParent HTB (hierarchical token bucket) that the child throttles will be governed by
circuitCodeCircuit code for this connection
agentIDAgentID for the connected agent
remoteEndPointRemote endpoint for this connection
defaultRTODefault retransmission timeout for unacked packets. The RTO will never drop beyond this number.
maxRTOThe maximum retransmission timeout for unacked packets. The RTO will never exceed this number.

Definition at line 237 of file LLUDPClient.cs.

Here is the call graph for this function:

Member Function Documentation

void OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.BackoffRTO ( )
inline

Exponential backoff of the retransmission timeout, per section 5.5 of RFC 2988

Definition at line 763 of file LLUDPClient.cs.

bool OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.DequeueOutgoing ( )
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

Returns
True if any packets were sent, otherwise false

Definition at line 628 of file LLUDPClient.cs.

Here is the call graph for this function:

Here is the caller graph for this function:

bool OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.EnqueueOutgoing ( OutgoingPacket  packet,
bool  forceQueue 
)
inline

Queue an outgoing packet if appropriate.

Parameters
packet
forceQueueAlways queue the packet if at all possible.
Returns
true if the packet has been queued, false if the packet has not been queued and should be sent immediately.

Definition at line 563 of file LLUDPClient.cs.

Here is the caller graph for this function:

bool OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.EnqueueOutgoing ( OutgoingPacket  packet,
bool  forceQueue,
bool  highPriority 
)
inline

Definition at line 568 of file LLUDPClient.cs.

Here is the call graph for this function:

void OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.FireQueueEmpty ( object  o)
inline

Fires the OnQueueEmpty callback and sets the minimum time that it can be called again

Parameters
oThrottle categories to fire the callback for, stored as an object to match the WaitCallback delegate signature

Definition at line 826 of file LLUDPClient.cs.

int OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.GetCatBytesCanSend ( ThrottleOutPacketType  cat,
int  timeMS 
)
inline

Definition at line 542 of file LLUDPClient.cs.

ClientInfo OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.GetClientInfo ( )
inline

Gets information about this client connection

Returns
Information about the client connection

Definition at line 303 of file LLUDPClient.cs.

int OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.GetPacketsQueuedCount ( ThrottleOutPacketType  throttleType)
inline

Get the number of packets queued for the given throttle type.

Returns
Parameters
throttleType

Definition at line 351 of file LLUDPClient.cs.

string OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.GetStats ( )
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.

Returns

Definition at line 367 of file LLUDPClient.cs.

byte [] OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.GetThrottlesPacked ( float  multiplier)
inline

Definition at line 501 of file LLUDPClient.cs.

int OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.GetTotalPacketsQueuedCount ( )
inline

Get the total number of pakcets queued for this client.

Returns

Definition at line 336 of file LLUDPClient.cs.

void OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.SendPacketStats ( )
inline

Definition at line 385 of file LLUDPClient.cs.

void OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.SetClientInfo ( ClientInfo  info)
inline

Modifies the UDP throttles

Parameters
infoNew throttling values

Definition at line 324 of file LLUDPClient.cs.

void OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.SetThrottles ( byte[]  throttleData)
inline

Definition at line 400 of file LLUDPClient.cs.

void OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.SetThrottles ( byte[]  throttleData,
float  factor 
)
inline

Definition at line 405 of file LLUDPClient.cs.

void OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.Shutdown ( )
inline

Shuts down this client connection

Definition at line 284 of file LLUDPClient.cs.

void OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.UpdateRoundTrip ( float  r)
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

Parameters
rRound-trip time of a single packet and its acknowledgement

Definition at line 728 of file LLUDPClient.cs.

Member Data Documentation

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

See Also
SRTT, RTTVAR

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.

Property Documentation

int OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.DebugDataOutLevel
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.

AdaptiveTokenBucket OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.FlowThrottle
get

Definition at line 174 of file LLUDPClient.cs.

int OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.PingTimeMS
get

Definition at line 201 of file LLUDPClient.cs.

int OpenSim.Region.ClientStack.LindenUDP.LLUDPClient.ThrottleDebugLevel
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.

Event Documentation

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.


The documentation for this class was generated from the following file: