aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs19
1 files changed, 15 insertions, 4 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs b/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs
index 677d3d1..2ec79ab 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs
@@ -340,6 +340,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
340 set { m_maxDripRate = (value == 0 ? 0 : Math.Max(value,m_minimumFlow)); } 340 set { m_maxDripRate = (value == 0 ? 0 : Math.Max(value,m_minimumFlow)); }
341 } 341 }
342 342
343 private bool m_enabled = false;
344
343 // <summary> 345 // <summary>
344 // 346 //
345 // </summary> 347 // </summary>
@@ -357,9 +359,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
357 // <summary> 359 // <summary>
358 // 360 //
359 // </summary> 361 // </summary>
360 public AdaptiveTokenBucket(TokenBucket parent, Int64 maxDripRate) : base(parent,m_minimumFlow) 362 public AdaptiveTokenBucket(TokenBucket parent, Int64 maxDripRate, bool enabled) : base(parent,maxDripRate)
361 { 363 {
362 MaxDripRate = maxDripRate; 364 m_enabled = enabled;
365
366 if (m_enabled)
367 {
368 m_log.WarnFormat("[TOKENBUCKET] Adaptive throttle enabled");
369 MaxDripRate = maxDripRate;
370 AdjustedDripRate = m_minimumFlow;
371 }
363 } 372 }
364 373
365 // <summary> 374 // <summary>
@@ -368,7 +377,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
368 public void ExpirePackets(Int32 count) 377 public void ExpirePackets(Int32 count)
369 { 378 {
370 // m_log.WarnFormat("[ADAPTIVEBUCKET] drop {0} by {1} expired packets",AdjustedDripRate,count); 379 // m_log.WarnFormat("[ADAPTIVEBUCKET] drop {0} by {1} expired packets",AdjustedDripRate,count);
371 AdjustedDripRate = (Int64) (AdjustedDripRate / Math.Pow(2,count)); 380 if (m_enabled)
381 AdjustedDripRate = (Int64) (AdjustedDripRate / Math.Pow(2,count));
372 } 382 }
373 383
374 // <summary> 384 // <summary>
@@ -376,7 +386,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
376 // </summary> 386 // </summary>
377 public void AcknowledgePackets(Int32 count) 387 public void AcknowledgePackets(Int32 count)
378 { 388 {
379 AdjustedDripRate = AdjustedDripRate + count; 389 if (m_enabled)
390 AdjustedDripRate = AdjustedDripRate + count;
380 } 391 }
381 } 392 }
382} 393}