aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorUbitUmarov2014-08-29 13:26:30 +0100
committerUbitUmarov2014-08-29 13:26:30 +0100
commit438798202fc1f578864a2796cb8a66b3199a77e0 (patch)
tree1441a7b0bf38eda38a75d0f5dfadaa312a10d5ed /OpenSim
parent disable first drip (diff)
downloadopensim-SC_OLD-438798202fc1f578864a2796cb8a66b3199a77e0.zip
opensim-SC_OLD-438798202fc1f578864a2796cb8a66b3199a77e0.tar.gz
opensim-SC_OLD-438798202fc1f578864a2796cb8a66b3199a77e0.tar.bz2
opensim-SC_OLD-438798202fc1f578864a2796cb8a66b3199a77e0.tar.xz
replace the tick() by a limit on the maximum number of tokens that can be
acumulated ( variable named BurtRate, not exactly a rate...)
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs52
2 files changed, 39 insertions, 15 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
index e760513..89a9401 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
@@ -616,8 +616,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
616 { 616 {
617 // No packets in this queue. Fire the queue empty callback 617 // No packets in this queue. Fire the queue empty callback
618 // if it has not been called recently 618 // if it has not been called recently
619
620 bucket.Tick(); // tick the bucket
621 emptyCategories |= CategoryToFlag(i); 619 emptyCategories |= CategoryToFlag(i);
622 } 620 }
623 } 621 }
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs
index a2ff884..3147095 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs
@@ -53,10 +53,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
53 protected const Int32 m_ticksPerQuantum = 1000; 53 protected const Int32 m_ticksPerQuantum = 1000;
54 54
55 /// <summary> 55 /// <summary>
56 /// This is the number of quantums worth of packets that can 56 /// This is the number of m_minimumDripRate bytes
57 /// be accommodated during a burst 57 /// allowed in a burst
58 /// roughtly, with this settings, the maximum time system will take
59 /// to recheck a bucket in ms
60 ///
58 /// </summary> 61 /// </summary>
59 protected const Double m_quantumsPerBurst = 1.5; 62 protected const Double m_quantumsPerBurst = 15;
60 63
61 /// <summary> 64 /// <summary>
62 /// </summary> 65 /// </summary>
@@ -91,22 +94,33 @@ namespace OpenSim.Region.ClientStack.LindenUDP
91 } 94 }
92 95
93 /// <summary> 96 /// <summary>
94 /// Maximum burst rate in bytes per second. This is the maximum number 97 /// This is the maximum number
95 /// of tokens that can accumulate in the bucket at any one time. This 98 /// of tokens that can accumulate in the bucket at any one time. This
96 /// also sets the total request for leaf nodes 99 /// also sets the total request for leaf nodes
100 /// this is not a rate.
97 /// </summary> 101 /// </summary>
98 protected Int64 m_burstRate; 102 protected Int64 m_burstRate;
99 public Int64 RequestedBurstRate 103 public Int64 RequestedBurstRate
100 { 104 {
101 get { return m_burstRate; } 105 get { return m_burstRate; }
102 set { m_burstRate = (value < 0 ? 0 : value); } 106 set {
107 double rate = (value < 0 ? 0 : value);
108 if (rate < m_minimumDripRate)
109 rate = m_minimumDripRate;
110 else if (rate > m_minimumDripRate * m_quantumsPerBurst)
111 rate = m_minimumDripRate * m_quantumsPerBurst;
112
113 m_burstRate = (Int64)rate;
114 }
103 } 115 }
104 116
105 public Int64 BurstRate 117 public Int64 BurstRate
106 { 118 {
107 get { 119 get {
108 double rate = RequestedBurstRate * BurstRateModifier(); 120 double rate = RequestedBurstRate * BurstRateModifier();
109 if (rate < m_minimumDripRate * m_quantumsPerBurst) 121 if (rate < m_minimumDripRate)
122 rate = m_minimumDripRate;
123 else if (rate > m_minimumDripRate * m_quantumsPerBurst)
110 rate = m_minimumDripRate * m_quantumsPerBurst; 124 rate = m_minimumDripRate * m_quantumsPerBurst;
111 125
112 return (Int64) rate; 126 return (Int64) rate;
@@ -126,8 +140,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
126 get { return (m_dripRate == 0 ? m_totalDripRequest : m_dripRate); } 140 get { return (m_dripRate == 0 ? m_totalDripRequest : m_dripRate); }
127 set { 141 set {
128 m_dripRate = (value < 0 ? 0 : value); 142 m_dripRate = (value < 0 ? 0 : value);
129 m_burstRate = (Int64)((double)m_dripRate * m_quantumsPerBurst);
130 m_totalDripRequest = m_dripRate; 143 m_totalDripRequest = m_dripRate;
144
145 double rate = m_dripRate;
146 if (rate > m_minimumDripRate * m_quantumsPerBurst)
147 rate = m_minimumDripRate * m_quantumsPerBurst;
148 else if (rate < m_minimumDripRate)
149 rate = m_minimumDripRate;
150
151 m_burstRate = (Int64)rate;
152
153 m_tokenCount = 0;
154
131 if (m_parent != null) 155 if (m_parent != null)
132 m_parent.RegisterRequest(this,m_dripRate); 156 m_parent.RegisterRequest(this,m_dripRate);
133 } 157 }
@@ -325,11 +349,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
325 349
326 Deposit(deltaMS * DripRate / m_ticksPerQuantum); 350 Deposit(deltaMS * DripRate / m_ticksPerQuantum);
327 } 351 }
328
329 public void Tick()
330 {
331 m_lastDrip = Util.EnvironmentTickCount();
332 }
333 } 352 }
334 353
335 public class AdaptiveTokenBucket : TokenBucket 354 public class AdaptiveTokenBucket : TokenBucket
@@ -364,7 +383,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
364 get { return m_dripRate; } 383 get { return m_dripRate; }
365 set { 384 set {
366 m_dripRate = OpenSim.Framework.Util.Clamp<Int64>(value,m_minimumFlow,MaxDripRate); 385 m_dripRate = OpenSim.Framework.Util.Clamp<Int64>(value,m_minimumFlow,MaxDripRate);
367 m_burstRate = (Int64)((double)m_dripRate * m_quantumsPerBurst); 386
387 double rate = m_dripRate;
388 if (rate > m_minimumDripRate * m_quantumsPerBurst)
389 rate = m_minimumDripRate * m_quantumsPerBurst;
390 else if (rate < m_minimumDripRate)
391 rate = m_minimumDripRate;
392 m_burstRate = (Int64)rate;
393
368 if (m_parent != null) 394 if (m_parent != null)
369 m_parent.RegisterRequest(this,m_dripRate); 395 m_parent.RegisterRequest(this,m_dripRate);
370 } 396 }