diff options
author | Justin Clark-Casey (justincc) | 2014-10-10 00:58:16 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-11-25 23:21:37 +0000 |
commit | 40314b56f28c5bdf186d7ba81b377c5011777a20 (patch) | |
tree | c5f6bb637ad41900f88a262eae361d3c69fe99fd | |
parent | minor: remove warnings from unused fields in LocalGridServicesConnector (diff) | |
download | opensim-SC-40314b56f28c5bdf186d7ba81b377c5011777a20.zip opensim-SC-40314b56f28c5bdf186d7ba81b377c5011777a20.tar.gz opensim-SC-40314b56f28c5bdf186d7ba81b377c5011777a20.tar.bz2 opensim-SC-40314b56f28c5bdf186d7ba81b377c5011777a20.tar.xz |
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.
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 13 | ||||
-rw-r--r-- | 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 | |||
97 | { | 97 | { |
98 | m_throttleDebugLevel = value; | 98 | m_throttleDebugLevel = value; |
99 | m_throttleClient.DebugLevel = m_throttleDebugLevel; | 99 | m_throttleClient.DebugLevel = m_throttleDebugLevel; |
100 | m_throttleCategory.DebugLevel = m_throttleDebugLevel; | ||
101 | foreach (TokenBucket tb in m_throttleCategories) | 100 | foreach (TokenBucket tb in m_throttleCategories) |
102 | tb.DebugLevel = m_throttleDebugLevel; | 101 | tb.DebugLevel = m_throttleDebugLevel; |
103 | } | 102 | } |
@@ -172,8 +171,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
172 | get { return m_throttleClient; } | 171 | get { return m_throttleClient; } |
173 | } | 172 | } |
174 | 173 | ||
175 | /// <summary>Throttle bucket for this agent's connection</summary> | ||
176 | private readonly TokenBucket m_throttleCategory; | ||
177 | /// <summary>Throttle buckets for each packet category</summary> | 174 | /// <summary>Throttle buckets for each packet category</summary> |
178 | private readonly TokenBucket[] m_throttleCategories; | 175 | private readonly TokenBucket[] m_throttleCategories; |
179 | /// <summary>Outgoing queues for throttled packets</summary> | 176 | /// <summary>Outgoing queues for throttled packets</summary> |
@@ -234,12 +231,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
234 | string.Format("adaptive throttle for {0} in {1}", AgentID, server.Scene.Name), | 231 | string.Format("adaptive throttle for {0} in {1}", AgentID, server.Scene.Name), |
235 | parentThrottle, rates.Total, rates.AdaptiveThrottlesEnabled); | 232 | parentThrottle, rates.Total, rates.AdaptiveThrottlesEnabled); |
236 | 233 | ||
237 | // Create a token bucket throttle for the total category with the client bucket as a throttle | ||
238 | m_throttleCategory | ||
239 | = new TokenBucket( | ||
240 | string.Format("total throttle for {0} in {1}", AgentID, server.Scene.Name), | ||
241 | m_throttleClient, 0); | ||
242 | |||
243 | // Create an array of token buckets for this clients different throttle categories | 234 | // Create an array of token buckets for this clients different throttle categories |
244 | m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT]; | 235 | m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT]; |
245 | 236 | ||
@@ -256,7 +247,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
256 | m_throttleCategories[i] | 247 | m_throttleCategories[i] |
257 | = new TokenBucket( | 248 | = new TokenBucket( |
258 | string.Format("{0} throttle for {1} in {2}", type, AgentID, server.Scene.Name), | 249 | string.Format("{0} throttle for {1} in {2}", type, AgentID, server.Scene.Name), |
259 | m_throttleCategory, rates.GetRate(type)); | 250 | m_throttleClient, rates.GetRate(type)); |
260 | } | 251 | } |
261 | 252 | ||
262 | // Default the retransmission timeout to one second | 253 | // Default the retransmission timeout to one second |
@@ -301,7 +292,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
301 | m_info.taskThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Task].DripRate; | 292 | m_info.taskThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Task].DripRate; |
302 | m_info.assetThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Asset].DripRate; | 293 | m_info.assetThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Asset].DripRate; |
303 | m_info.textureThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Texture].DripRate; | 294 | m_info.textureThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Texture].DripRate; |
304 | m_info.totalThrottle = (int)m_throttleCategory.DripRate; | 295 | m_info.totalThrottle = (int)m_throttleClient.DripRate; |
305 | m_info.maxThrottle = (int)m_throttleClient.MaxDripRate; | 296 | m_info.maxThrottle = (int)m_throttleClient.MaxDripRate; |
306 | 297 | ||
307 | return m_info; | 298 | 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 | |||
352 | m_dripRate = OpenSim.Framework.Util.Clamp<Int64>(value,m_minimumFlow,MaxDripRate); | 352 | m_dripRate = OpenSim.Framework.Util.Clamp<Int64>(value,m_minimumFlow,MaxDripRate); |
353 | m_burstRate = (Int64)((double)m_dripRate * m_quantumsPerBurst); | 353 | m_burstRate = (Int64)((double)m_dripRate * m_quantumsPerBurst); |
354 | if (m_parent != null) | 354 | if (m_parent != null) |
355 | m_parent.RegisterRequest(this,m_dripRate); | 355 | m_parent.RegisterRequest(this, m_dripRate); |
356 | } | 356 | } |
357 | } | 357 | } |
358 | 358 | ||
359 | // <summary> | ||
360 | // | ||
361 | // </summary> | ||
362 | public AdaptiveTokenBucket(string identifier, TokenBucket parent, Int64 maxDripRate, bool enabled) | 359 | public AdaptiveTokenBucket(string identifier, TokenBucket parent, Int64 maxDripRate, bool enabled) |
363 | : base(identifier, parent, maxDripRate) | 360 | : base(identifier, parent, maxDripRate) |
364 | { | 361 | { |