Fix the negative number problem in TokenBucket. mantis #5365
parent
830fee145d
commit
1cd951e5ae
|
@ -207,14 +207,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
int dripAmount = deltaMS * tokensPerMS;
|
int dripAmount = deltaMS * tokensPerMS;
|
||||||
|
|
||||||
if (dripAmount < 0)
|
|
||||||
Console.WriteLine("MAY DAY MAY DAY! Drip amount is " + dripAmount + ". This should not happen");
|
|
||||||
|
|
||||||
content = Math.Min(content + dripAmount, maxBurst);
|
content = Math.Min(content + dripAmount, maxBurst);
|
||||||
lastDrip = now;
|
lastDrip = now;
|
||||||
|
|
||||||
if (content < 0)
|
if (dripAmount < 0 || content < 0)
|
||||||
Console.WriteLine("MAY DAY MAY DAY! Content is " + content + ". This should not happen");
|
// sim has been idle for too long, integer has overflown
|
||||||
|
// previous calculation is meaningless, let's put it at correct max
|
||||||
|
content = maxBurst;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue