aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs24
1 files changed, 11 insertions, 13 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs
index 0ac573a..7b9661b 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs
@@ -62,8 +62,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
62 /// </summary> 62 /// </summary>
63 protected const float m_minimumDripRate = 1500; 63 protected const float m_minimumDripRate = 1500;
64 64
65 /// <summary>Time of the last drip, in system ticks</summary> 65 /// <summary>Time of the last drip</summary>
66 protected Int32 m_lastDrip; 66 protected double m_lastDrip;
67 67
68 /// <summary> 68 /// <summary>
69 /// The number of bytes that can be sent at this moment. This is the 69 /// The number of bytes that can be sent at this moment. This is the
@@ -166,10 +166,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
166 /// </summary> 166 /// </summary>
167 protected float m_totalDripRequest; 167 protected float m_totalDripRequest;
168 public float TotalDripRequest 168 public float TotalDripRequest
169 { 169 {
170 get { return m_totalDripRequest; } 170 get { return m_totalDripRequest; }
171 set { m_totalDripRequest = value; } 171 set { m_totalDripRequest = value; }
172 } 172 }
173 173
174#endregion Properties 174#endregion Properties
175 175
@@ -193,9 +193,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
193 Parent = parent; 193 Parent = parent;
194 RequestedDripRate = dripRate; 194 RequestedDripRate = dripRate;
195 RequestedBurst = MaxBurst; 195 RequestedBurst = MaxBurst;
196 // TotalDripRequest = dripRate; // this will be overwritten when a child node registers 196 m_lastDrip = Util.GetTimeStampMS() + 50.0;
197 // MaxBurst = (Int64)((double)dripRate * m_quantumsPerBurst);
198 m_lastDrip = Util.EnvironmentTickCount() + 100000;
199 } 197 }
200 198
201#endregion Constructor 199#endregion Constructor
@@ -210,7 +208,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
210 protected float DripRateModifier() 208 protected float DripRateModifier()
211 { 209 {
212 float driprate = DripRate; 210 float driprate = DripRate;
213 return driprate >= TotalDripRequest ? 1.0f : driprate / TotalDripRequest; 211 return driprate >= TotalDripRequest ? 1.0f : (driprate / TotalDripRequest);
214 } 212 }
215 213
216 /// <summary> 214 /// <summary>
@@ -313,14 +311,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
313 return; 311 return;
314 } 312 }
315 313
316 Int32 now = Util.EnvironmentTickCount(); 314 double now = Util.GetTimeStampMS();
317 Int32 deltaMS = now - m_lastDrip; 315 double deltaMS = now - m_lastDrip;
318 m_lastDrip = now; 316 m_lastDrip = now;
319 317
320 if (deltaMS <= 0) 318 if (deltaMS <= 0)
321 return; 319 return;
322 320
323 m_tokenCount += deltaMS * DripRate * m_timeScale; 321 m_tokenCount += (float)deltaMS * DripRate * m_timeScale;
324 322
325 float burst = Burst; 323 float burst = Burst;
326 if (m_tokenCount > burst) 324 if (m_tokenCount > burst)