From c6246050d9237293cc6b72e3adf6267617603259 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 30 Oct 2009 22:07:56 +0000 Subject: [PATCH] Make the default and max RTO configurable int he linden client stack --- .../Region/ClientStack/LindenUDP/LLUDPClient.cs | 16 ++++++++++++---- .../Region/ClientStack/LindenUDP/LLUDPServer.cs | 8 +++++++- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs index 6619dcb258..9856a1cce4 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs @@ -143,6 +143,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// A reference to the LLUDPServer that is managing this client private readonly LLUDPServer m_udpServer; + private int m_defaultRTO = 3000; + private int m_maxRTO = 60000; + /// /// Default constructor /// @@ -153,12 +156,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Circuit code for this connection /// AgentID for the connected agent /// Remote endpoint for this connection - 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; RemoteEndPoint = remoteEndPoint; CircuitCode = circuitCode; 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 m_throttle = new TokenBucket(parentThrottle, rates.TotalLimit, rates.Total); // 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 - RTO = 3000; + RTO = m_defaultRTO; // Initialize this to a sane value to prevent early disconnects 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)); // Clamp the retransmission timeout to manageable values - rto = Utils.Clamp(RTO, 3000, 60000); + rto = Utils.Clamp(RTO, m_defaultRTO, m_maxRTO); RTO = rto; @@ -517,7 +525,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP RTTVAR = 0.0f; // Double the retransmission timeout - RTO = Math.Min(RTO * 2, 60000); + RTO = Math.Min(RTO * 2, m_maxRTO); } /// diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 6f949213d8..93946ae50b 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -153,6 +153,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Flag to signal when clients should send pings private bool m_sendPing; + private int m_defaultRTO = 0; + private int m_maxRTO = 0; + public Socket Server { get { return null; } } 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); PrimFullUpdatesPerPacket = config.GetInt("PrimFullUpdatesPerPacket", 100); TextureSendLimit = config.GetInt("TextureSendLimit", 20); + + m_defaultRTO = config.GetInt("DefaultRTO", 0); + m_maxRTO = config.GetInt("MaxRTO", 0); } else { @@ -766,7 +772,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP protected virtual void AddClient(uint circuitCode, UUID agentID, UUID sessionID, IPEndPoint remoteEndPoint, AuthenticateResponse sessionInfo) { // 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; if (!m_scene.TryGetClient(agentID, out existingClient))