Make the default and max RTO configurable int he linden client stack

0.6.8-post-fixes
Melanie 2009-10-30 22:07:56 +00:00
parent 2e81acec48
commit c6246050d9
2 changed files with 19 additions and 5 deletions

View File

@ -143,6 +143,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <summary>A reference to the LLUDPServer that is managing this client</summary> /// <summary>A reference to the LLUDPServer that is managing this client</summary>
private readonly LLUDPServer m_udpServer; private readonly LLUDPServer m_udpServer;
private int m_defaultRTO = 3000;
private int m_maxRTO = 60000;
/// <summary> /// <summary>
/// Default constructor /// Default constructor
/// </summary> /// </summary>
@ -153,12 +156,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <param name="circuitCode">Circuit code for this connection</param> /// <param name="circuitCode">Circuit code for this connection</param>
/// <param name="agentID">AgentID for the connected agent</param> /// <param name="agentID">AgentID for the connected agent</param>
/// <param name="remoteEndPoint">Remote endpoint for this connection</param> /// <param name="remoteEndPoint">Remote endpoint for this connection</param>
public LLUDPClient(LLUDPServer server, ThrottleRates rates, TokenBucket parentThrottle, uint circuitCode, UUID agentID, IPEndPoint remoteEndPoint) public LLUDPClient(LLUDPServer server, ThrottleRates rates, TokenBucket parentThrottle, uint circuitCode, UUID agentID, IPEndPoint remoteEndPoint, int defaultRTO, int maxRTO)
{ {
AgentID = agentID; AgentID = agentID;
RemoteEndPoint = remoteEndPoint; RemoteEndPoint = remoteEndPoint;
CircuitCode = circuitCode; CircuitCode = circuitCode;
m_udpServer = server; m_udpServer = server;
if (defaultRTO != 0)
m_defaultRTO = defaultRTO;
if (maxRTO != 0)
m_maxRTO = maxRTO;
// Create a token bucket throttle for this client that has the scene token bucket as a parent // Create a token bucket throttle for this client that has the scene token bucket as a parent
m_throttle = new TokenBucket(parentThrottle, rates.TotalLimit, rates.Total); m_throttle = new TokenBucket(parentThrottle, rates.TotalLimit, rates.Total);
// Create an array of token buckets for this clients different throttle categories // Create an array of token buckets for this clients different throttle categories
@ -175,7 +183,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
// Default the retransmission timeout to three seconds // Default the retransmission timeout to three seconds
RTO = 3000; RTO = m_defaultRTO;
// Initialize this to a sane value to prevent early disconnects // Initialize this to a sane value to prevent early disconnects
TickLastPacketReceived = Environment.TickCount & Int32.MaxValue; TickLastPacketReceived = Environment.TickCount & Int32.MaxValue;
@ -497,7 +505,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
int rto = (int)(SRTT + Math.Max(m_udpServer.TickCountResolution, K * RTTVAR)); int rto = (int)(SRTT + Math.Max(m_udpServer.TickCountResolution, K * RTTVAR));
// Clamp the retransmission timeout to manageable values // Clamp the retransmission timeout to manageable values
rto = Utils.Clamp(RTO, 3000, 60000); rto = Utils.Clamp(RTO, m_defaultRTO, m_maxRTO);
RTO = rto; RTO = rto;
@ -517,7 +525,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
RTTVAR = 0.0f; RTTVAR = 0.0f;
// Double the retransmission timeout // Double the retransmission timeout
RTO = Math.Min(RTO * 2, 60000); RTO = Math.Min(RTO * 2, m_maxRTO);
} }
/// <summary> /// <summary>

View File

@ -153,6 +153,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <summary>Flag to signal when clients should send pings</summary> /// <summary>Flag to signal when clients should send pings</summary>
private bool m_sendPing; private bool m_sendPing;
private int m_defaultRTO = 0;
private int m_maxRTO = 0;
public Socket Server { get { return null; } } public Socket Server { get { return null; } }
public LLUDPServer(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager) public LLUDPServer(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager)
@ -189,6 +192,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
AvatarTerseUpdatesPerPacket = config.GetInt("AvatarTerseUpdatesPerPacket", 10); AvatarTerseUpdatesPerPacket = config.GetInt("AvatarTerseUpdatesPerPacket", 10);
PrimFullUpdatesPerPacket = config.GetInt("PrimFullUpdatesPerPacket", 100); PrimFullUpdatesPerPacket = config.GetInt("PrimFullUpdatesPerPacket", 100);
TextureSendLimit = config.GetInt("TextureSendLimit", 20); TextureSendLimit = config.GetInt("TextureSendLimit", 20);
m_defaultRTO = config.GetInt("DefaultRTO", 0);
m_maxRTO = config.GetInt("MaxRTO", 0);
} }
else else
{ {
@ -766,7 +772,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
protected virtual void AddClient(uint circuitCode, UUID agentID, UUID sessionID, IPEndPoint remoteEndPoint, AuthenticateResponse sessionInfo) protected virtual void AddClient(uint circuitCode, UUID agentID, UUID sessionID, IPEndPoint remoteEndPoint, AuthenticateResponse sessionInfo)
{ {
// Create the LLUDPClient // Create the LLUDPClient
LLUDPClient udpClient = new LLUDPClient(this, m_throttleRates, m_throttle, circuitCode, agentID, remoteEndPoint); LLUDPClient udpClient = new LLUDPClient(this, m_throttleRates, m_throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO);
IClientAPI existingClient; IClientAPI existingClient;
if (!m_scene.TryGetClient(agentID, out existingClient)) if (!m_scene.TryGetClient(agentID, out existingClient))