change the clock source on tokenBucket

melanie
UbitUmarov 2016-11-08 23:09:53 +00:00
parent 6c44dceced
commit 92984556e1
1 changed files with 11 additions and 13 deletions

View File

@ -62,8 +62,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// </summary> /// </summary>
protected const float m_minimumDripRate = 1500; protected const float m_minimumDripRate = 1500;
/// <summary>Time of the last drip, in system ticks</summary> /// <summary>Time of the last drip</summary>
protected Int32 m_lastDrip; protected double m_lastDrip;
/// <summary> /// <summary>
/// The number of bytes that can be sent at this moment. This is the /// The number of bytes that can be sent at this moment. This is the
@ -193,9 +193,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
Parent = parent; Parent = parent;
RequestedDripRate = dripRate; RequestedDripRate = dripRate;
RequestedBurst = MaxBurst; RequestedBurst = MaxBurst;
// TotalDripRequest = dripRate; // this will be overwritten when a child node registers m_lastDrip = Util.GetTimeStampMS() + 50.0;
// MaxBurst = (Int64)((double)dripRate * m_quantumsPerBurst);
m_lastDrip = Util.EnvironmentTickCount() + 100000;
} }
#endregion Constructor #endregion Constructor
@ -210,7 +208,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
protected float DripRateModifier() protected float DripRateModifier()
{ {
float driprate = DripRate; float driprate = DripRate;
return driprate >= TotalDripRequest ? 1.0f : driprate / TotalDripRequest; return driprate >= TotalDripRequest ? 1.0f : (driprate / TotalDripRequest);
} }
/// <summary> /// <summary>
@ -313,14 +311,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return; return;
} }
Int32 now = Util.EnvironmentTickCount(); double now = Util.GetTimeStampMS();
Int32 deltaMS = now - m_lastDrip; double deltaMS = now - m_lastDrip;
m_lastDrip = now; m_lastDrip = now;
if (deltaMS <= 0) if (deltaMS <= 0)
return; return;
m_tokenCount += deltaMS * DripRate * m_timeScale; m_tokenCount += (float)deltaMS * DripRate * m_timeScale;
float burst = Burst; float burst = Burst;
if (m_tokenCount > burst) if (m_tokenCount > burst)