From 40314b56f28c5bdf186d7ba81b377c5011777a20 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 10 Oct 2014 00:58:16 +0100 Subject: Remove the unnecessary intermediate total token bucket. This only had one child, which is the 'adaptive' token bucket. So from testing and currently analysis, we can use that bucket directly which simplifies the code. --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 13 ++----------- OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs | 5 +---- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index e9f1ca2..6864d37 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -97,7 +97,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP { m_throttleDebugLevel = value; m_throttleClient.DebugLevel = m_throttleDebugLevel; - m_throttleCategory.DebugLevel = m_throttleDebugLevel; foreach (TokenBucket tb in m_throttleCategories) tb.DebugLevel = m_throttleDebugLevel; } @@ -172,8 +171,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP get { return m_throttleClient; } } - /// Throttle bucket for this agent's connection - private readonly TokenBucket m_throttleCategory; /// Throttle buckets for each packet category private readonly TokenBucket[] m_throttleCategories; /// Outgoing queues for throttled packets @@ -234,12 +231,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP string.Format("adaptive throttle for {0} in {1}", AgentID, server.Scene.Name), parentThrottle, rates.Total, rates.AdaptiveThrottlesEnabled); - // Create a token bucket throttle for the total category with the client bucket as a throttle - m_throttleCategory - = new TokenBucket( - string.Format("total throttle for {0} in {1}", AgentID, server.Scene.Name), - m_throttleClient, 0); - // Create an array of token buckets for this clients different throttle categories m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT]; @@ -256,7 +247,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_throttleCategories[i] = new TokenBucket( string.Format("{0} throttle for {1} in {2}", type, AgentID, server.Scene.Name), - m_throttleCategory, rates.GetRate(type)); + m_throttleClient, rates.GetRate(type)); } // Default the retransmission timeout to one second @@ -301,7 +292,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_info.taskThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Task].DripRate; m_info.assetThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Asset].DripRate; m_info.textureThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Texture].DripRate; - m_info.totalThrottle = (int)m_throttleCategory.DripRate; + m_info.totalThrottle = (int)m_throttleClient.DripRate; m_info.maxThrottle = (int)m_throttleClient.MaxDripRate; return m_info; diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs index 87ec5fb..fbc40a6 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs @@ -352,13 +352,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_dripRate = OpenSim.Framework.Util.Clamp(value,m_minimumFlow,MaxDripRate); m_burstRate = (Int64)((double)m_dripRate * m_quantumsPerBurst); if (m_parent != null) - m_parent.RegisterRequest(this,m_dripRate); + m_parent.RegisterRequest(this, m_dripRate); } } - // - // - // public AdaptiveTokenBucket(string identifier, TokenBucket parent, Int64 maxDripRate, bool enabled) : base(identifier, parent, maxDripRate) { -- cgit v1.1