add method to get a category throttle rate
parent
fd0a635302
commit
7351d92a76
|
@ -1186,6 +1186,7 @@ namespace OpenSim.Framework
|
||||||
void SetChildAgentThrottle(byte[] throttle);
|
void SetChildAgentThrottle(byte[] throttle);
|
||||||
|
|
||||||
void SetAgentThrottleSilent(int throttle, int setting);
|
void SetAgentThrottleSilent(int throttle, int setting);
|
||||||
|
int GetAgentThrottleSilent(int throttle);
|
||||||
|
|
||||||
void SendAvatarDataImmediate(ISceneEntity avatar);
|
void SendAvatarDataImmediate(ISceneEntity avatar);
|
||||||
|
|
||||||
|
|
|
@ -12306,16 +12306,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets the throttles from values supplied by the client
|
/// Sets the throttles from values supplied caller
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="throttles"></param>
|
/// <param name="throttles"></param>
|
||||||
public void SetAgentThrottleSilent(int throttle, int setting)
|
public void SetAgentThrottleSilent(int throttle, int setting)
|
||||||
{
|
{
|
||||||
m_udpClient.ForceThrottleSetting(throttle,setting);
|
m_udpClient.ForceThrottleSetting(throttle,setting);
|
||||||
//m_udpClient.SetThrottles(throttles);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int GetAgentThrottleSilent(int throttle)
|
||||||
|
{
|
||||||
|
return m_udpClient.GetThrottleSetting(throttle);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the current throttles for this client as a packed byte array
|
/// Get the current throttles for this client as a packed byte array
|
||||||
|
|
|
@ -688,6 +688,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
RTO = Math.Min(RTO * 2, m_maxRTO);
|
RTO = Math.Min(RTO * 2, m_maxRTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const int MIN_CALLBACK_MS = 30;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Does an early check to see if this queue empty callback is already
|
/// Does an early check to see if this queue empty callback is already
|
||||||
/// running, then asynchronously firing the event
|
/// running, then asynchronously firing the event
|
||||||
|
@ -695,24 +698,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
/// <param name="categories">Throttle categories to fire the callback for</param>
|
/// <param name="categories">Throttle categories to fire the callback for</param>
|
||||||
private void BeginFireQueueEmpty(ThrottleOutPacketTypeFlags categories)
|
private void BeginFireQueueEmpty(ThrottleOutPacketTypeFlags categories)
|
||||||
{
|
{
|
||||||
// if (m_nextOnQueueEmpty != 0 && (Environment.TickCount & Int32.MaxValue) >= m_nextOnQueueEmpty)
|
if (!m_isQueueEmptyRunning)
|
||||||
if (!m_isQueueEmptyRunning && (Environment.TickCount & Int32.MaxValue) >= m_nextOnQueueEmpty)
|
|
||||||
{
|
{
|
||||||
m_isQueueEmptyRunning = true;
|
|
||||||
|
|
||||||
int start = Environment.TickCount & Int32.MaxValue;
|
int start = Environment.TickCount & Int32.MaxValue;
|
||||||
const int MIN_CALLBACK_MS = 30;
|
|
||||||
|
if (start < m_nextOnQueueEmpty)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_isQueueEmptyRunning = true;
|
||||||
|
|
||||||
m_nextOnQueueEmpty = start + MIN_CALLBACK_MS;
|
m_nextOnQueueEmpty = start + MIN_CALLBACK_MS;
|
||||||
if (m_nextOnQueueEmpty == 0)
|
if (m_nextOnQueueEmpty == 0)
|
||||||
m_nextOnQueueEmpty = 1;
|
m_nextOnQueueEmpty = 1;
|
||||||
|
|
||||||
// Use a value of 0 to signal that FireQueueEmpty is running
|
if (HasUpdates(categories))
|
||||||
// m_nextOnQueueEmpty = 0;
|
|
||||||
|
|
||||||
m_categories = categories;
|
|
||||||
|
|
||||||
if (HasUpdates(m_categories))
|
|
||||||
{
|
{
|
||||||
// Asynchronously run the callback
|
// Asynchronously run the callback
|
||||||
Util.FireAndForget(FireQueueEmpty, categories);
|
Util.FireAndForget(FireQueueEmpty, categories);
|
||||||
|
@ -725,7 +724,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool m_isQueueEmptyRunning;
|
private bool m_isQueueEmptyRunning;
|
||||||
private ThrottleOutPacketTypeFlags m_categories = 0;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fires the OnQueueEmpty callback and sets the minimum time that it
|
/// Fires the OnQueueEmpty callback and sets the minimum time that it
|
||||||
|
@ -736,35 +735,33 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
/// signature</param>
|
/// signature</param>
|
||||||
private void FireQueueEmpty(object o)
|
private void FireQueueEmpty(object o)
|
||||||
{
|
{
|
||||||
// int start = Environment.TickCount & Int32.MaxValue;
|
|
||||||
// const int MIN_CALLBACK_MS = 30;
|
|
||||||
|
|
||||||
// if (m_udpServer.IsRunningOutbound)
|
|
||||||
// {
|
|
||||||
ThrottleOutPacketTypeFlags categories = (ThrottleOutPacketTypeFlags)o;
|
ThrottleOutPacketTypeFlags categories = (ThrottleOutPacketTypeFlags)o;
|
||||||
QueueEmpty callback = OnQueueEmpty;
|
QueueEmpty callback = OnQueueEmpty;
|
||||||
|
|
||||||
if (callback != null)
|
if (callback != null)
|
||||||
{
|
{
|
||||||
// if (m_udpServer.IsRunningOutbound)
|
// if (m_udpServer.IsRunningOutbound)
|
||||||
// {
|
// {
|
||||||
try { callback(categories); }
|
try { callback(categories); }
|
||||||
catch (Exception e) { m_log.Error("[LLUDPCLIENT]: OnQueueEmpty(" + categories + ") threw an exception: " + e.Message, e); }
|
catch (Exception e) { m_log.Error("[LLUDPCLIENT]: OnQueueEmpty(" + categories + ") threw an exception: " + e.Message, e); }
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
// m_nextOnQueueEmpty = start + MIN_CALLBACK_MS;
|
|
||||||
// if (m_nextOnQueueEmpty == 0)
|
|
||||||
// m_nextOnQueueEmpty = 1;
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
m_isQueueEmptyRunning = false;
|
m_isQueueEmptyRunning = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void ForceThrottleSetting(int throttle, int setting)
|
internal void ForceThrottleSetting(int throttle, int setting)
|
||||||
{
|
{
|
||||||
m_throttleCategories[throttle].RequestedDripRate = Math.Max(setting, LLUDPServer.MTU); ;
|
if (throttle > 0 && throttle < THROTTLE_CATEGORY_COUNT)
|
||||||
|
m_throttleCategories[throttle].RequestedDripRate = Math.Max(setting, LLUDPServer.MTU);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal int GetThrottleSetting(int throttle)
|
||||||
|
{
|
||||||
|
if (throttle > 0 && throttle < THROTTLE_CATEGORY_COUNT)
|
||||||
|
return (int)m_throttleCategories[throttle].RequestedDripRate;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1705,5 +1705,10 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
||||||
public void SendPartFullUpdate(ISceneEntity ent, uint? parentID)
|
public void SendPartFullUpdate(ISceneEntity ent, uint? parentID)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int GetAgentThrottleSilent(int throttle)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1276,5 +1276,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int GetAgentThrottleSilent(int throttle)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -548,6 +548,11 @@ namespace OpenSim.Tests.Common.Mock
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int GetAgentThrottleSilent(int throttle)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
public byte[] GetThrottlesPacked(float multiplier)
|
public byte[] GetThrottlesPacked(float multiplier)
|
||||||
{
|
{
|
||||||
return new byte[0];
|
return new byte[0];
|
||||||
|
|
Loading…
Reference in New Issue