aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack
diff options
context:
space:
mode:
authorDiva Canto2010-12-13 09:42:27 -0800
committerDiva Canto2010-12-13 09:42:27 -0800
commit870bbcfc6c264c515ac660837d16ccad4e59ac64 (patch)
tree0e06406762219ae46a28a19fa3fc84f7987a29aa /OpenSim/Region/ClientStack
parentFixed wrong configuration variable names. (diff)
downloadopensim-SC-870bbcfc6c264c515ac660837d16ccad4e59ac64.zip
opensim-SC-870bbcfc6c264c515ac660837d16ccad4e59ac64.tar.gz
opensim-SC-870bbcfc6c264c515ac660837d16ccad4e59ac64.tar.bz2
opensim-SC-870bbcfc6c264c515ac660837d16ccad4e59ac64.tar.xz
This may have been the biggest, baddest bug in OpenSim ever... confusion between bytes per second and bytes per millisecond.
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs13
1 files changed, 11 insertions, 2 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs b/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs
index bdbd284..4d9ca09 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs
@@ -119,6 +119,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
119 119
120 #endregion Properties 120 #endregion Properties
121 121
122 // To help debugging
123 private static int idCount = 0;
124 private int id;
125
122 /// <summary> 126 /// <summary>
123 /// Default constructor 127 /// Default constructor
124 /// </summary> 128 /// </summary>
@@ -134,6 +138,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
134 MaxBurst = maxBurst; 138 MaxBurst = maxBurst;
135 DripRate = dripRate; 139 DripRate = dripRate;
136 lastDrip = Environment.TickCount & Int32.MaxValue; 140 lastDrip = Environment.TickCount & Int32.MaxValue;
141 id = idCount++;
137 } 142 }
138 143
139 /// <summary> 144 /// <summary>
@@ -191,6 +196,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
191 if (tokensPerMS == 0) 196 if (tokensPerMS == 0)
192 { 197 {
193 content = maxBurst; 198 content = maxBurst;
199 //Console.WriteLine("XXX (" + id + ") content = maxBurst and maxBurst = " + maxBurst);
194 return true; 200 return true;
195 } 201 }
196 else 202 else
@@ -205,11 +211,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
205 return false; 211 return false;
206 } 212 }
207 213
208 int dripAmount = deltaMS * tokensPerMS; 214 // dripAmpount here is in bytes per millisecond
209 215 int dripAmount = deltaMS * tokensPerMS;
216 // but content is in bytes per second, so let's multiply by 1000
217 dripAmount = dripAmount * 1000;
210 content = Math.Min(content + dripAmount, maxBurst); 218 content = Math.Min(content + dripAmount, maxBurst);
211 lastDrip = now; 219 lastDrip = now;
212 220
221 //Console.WriteLine("XXX (" + id + ") deltaMS=" + deltaMS + "; tokensPerMS=" + tokensPerMS + "; content=" + content + "; dripAmount=" + dripAmount);
213 return true; 222 return true;
214 } 223 }
215 } 224 }