This may have been the biggest, baddest bug in OpenSim ever... confusion between bytes per second and bytes per millisecond.
parent
8ea4933742
commit
870bbcfc6c
|
@ -119,6 +119,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
#endregion Properties
|
#endregion Properties
|
||||||
|
|
||||||
|
// To help debugging
|
||||||
|
private static int idCount = 0;
|
||||||
|
private int id;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Default constructor
|
/// Default constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -134,6 +138,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
MaxBurst = maxBurst;
|
MaxBurst = maxBurst;
|
||||||
DripRate = dripRate;
|
DripRate = dripRate;
|
||||||
lastDrip = Environment.TickCount & Int32.MaxValue;
|
lastDrip = Environment.TickCount & Int32.MaxValue;
|
||||||
|
id = idCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -191,6 +196,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
if (tokensPerMS == 0)
|
if (tokensPerMS == 0)
|
||||||
{
|
{
|
||||||
content = maxBurst;
|
content = maxBurst;
|
||||||
|
//Console.WriteLine("XXX (" + id + ") content = maxBurst and maxBurst = " + maxBurst);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -205,11 +211,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dripAmount = deltaMS * tokensPerMS;
|
// dripAmpount here is in bytes per millisecond
|
||||||
|
int dripAmount = deltaMS * tokensPerMS;
|
||||||
|
// but content is in bytes per second, so let's multiply by 1000
|
||||||
|
dripAmount = dripAmount * 1000;
|
||||||
content = Math.Min(content + dripAmount, maxBurst);
|
content = Math.Min(content + dripAmount, maxBurst);
|
||||||
lastDrip = now;
|
lastDrip = now;
|
||||||
|
|
||||||
|
//Console.WriteLine("XXX (" + id + ") deltaMS=" + deltaMS + "; tokensPerMS=" + tokensPerMS + "; content=" + content + "; dripAmount=" + dripAmount);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue