aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs
diff options
context:
space:
mode:
authorDiva Canto2011-02-09 09:39:53 -0800
committerDiva Canto2011-02-09 09:39:53 -0800
commit1cd951e5aedad4be809fc2674e57e34d0972b67c (patch)
treeb726831044960ba10d2d05792903bf0bdd3a940a /OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs
parentRevert "Brute-force debug -- mantis #5365" (diff)
downloadopensim-SC_OLD-1cd951e5aedad4be809fc2674e57e34d0972b67c.zip
opensim-SC_OLD-1cd951e5aedad4be809fc2674e57e34d0972b67c.tar.gz
opensim-SC_OLD-1cd951e5aedad4be809fc2674e57e34d0972b67c.tar.bz2
opensim-SC_OLD-1cd951e5aedad4be809fc2674e57e34d0972b67c.tar.xz
Fix the negative number problem in TokenBucket. mantis #5365
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs9
1 files changed, 4 insertions, 5 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs b/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs
index de8b521..0a8331f 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs
@@ -207,14 +207,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
207 207
208 int dripAmount = deltaMS * tokensPerMS; 208 int dripAmount = deltaMS * tokensPerMS;
209 209
210 if (dripAmount < 0)
211 Console.WriteLine("MAY DAY MAY DAY! Drip amount is " + dripAmount + ". This should not happen");
212
213 content = Math.Min(content + dripAmount, maxBurst); 210 content = Math.Min(content + dripAmount, maxBurst);
214 lastDrip = now; 211 lastDrip = now;
215 212
216 if (content < 0) 213 if (dripAmount < 0 || content < 0)
217 Console.WriteLine("MAY DAY MAY DAY! Content is " + content + ". This should not happen"); 214 // sim has been idle for too long, integer has overflown
215 // previous calculation is meaningless, let's put it at correct max
216 content = maxBurst;
218 217
219 return true; 218 return true;
220 } 219 }