add method to get a category throttle rate
parent
fd0a635302
commit
7351d92a76
|
@ -1186,6 +1186,7 @@ namespace OpenSim.Framework
|
|||
void SetChildAgentThrottle(byte[] throttle);
|
||||
|
||||
void SetAgentThrottleSilent(int throttle, int setting);
|
||||
int GetAgentThrottleSilent(int throttle);
|
||||
|
||||
void SendAvatarDataImmediate(ISceneEntity avatar);
|
||||
|
||||
|
|
|
@ -12306,16 +12306,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the throttles from values supplied by the client
|
||||
/// Sets the throttles from values supplied caller
|
||||
/// </summary>
|
||||
/// <param name="throttles"></param>
|
||||
public void SetAgentThrottleSilent(int throttle, int setting)
|
||||
{
|
||||
m_udpClient.ForceThrottleSetting(throttle,setting);
|
||||
//m_udpClient.SetThrottles(throttles);
|
||||
|
||||
}
|
||||
|
||||
public int GetAgentThrottleSilent(int throttle)
|
||||
{
|
||||
return m_udpClient.GetThrottleSetting(throttle);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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);
|
||||
}
|
||||
|
||||
|
||||
const int MIN_CALLBACK_MS = 30;
|
||||
|
||||
/// <summary>
|
||||
/// Does an early check to see if this queue empty callback is already
|
||||
/// 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>
|
||||
private void BeginFireQueueEmpty(ThrottleOutPacketTypeFlags categories)
|
||||
{
|
||||
// if (m_nextOnQueueEmpty != 0 && (Environment.TickCount & Int32.MaxValue) >= m_nextOnQueueEmpty)
|
||||
if (!m_isQueueEmptyRunning && (Environment.TickCount & Int32.MaxValue) >= m_nextOnQueueEmpty)
|
||||
if (!m_isQueueEmptyRunning)
|
||||
{
|
||||
m_isQueueEmptyRunning = true;
|
||||
|
||||
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;
|
||||
if (m_nextOnQueueEmpty == 0)
|
||||
m_nextOnQueueEmpty = 1;
|
||||
|
||||
// Use a value of 0 to signal that FireQueueEmpty is running
|
||||
// m_nextOnQueueEmpty = 0;
|
||||
|
||||
m_categories = categories;
|
||||
|
||||
if (HasUpdates(m_categories))
|
||||
if (HasUpdates(categories))
|
||||
{
|
||||
// Asynchronously run the callback
|
||||
Util.FireAndForget(FireQueueEmpty, categories);
|
||||
|
@ -725,7 +724,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
}
|
||||
|
||||
private bool m_isQueueEmptyRunning;
|
||||
private ThrottleOutPacketTypeFlags m_categories = 0;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Fires the OnQueueEmpty callback and sets the minimum time that it
|
||||
|
@ -736,35 +735,33 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
/// signature</param>
|
||||
private void FireQueueEmpty(object o)
|
||||
{
|
||||
// int start = Environment.TickCount & Int32.MaxValue;
|
||||
// const int MIN_CALLBACK_MS = 30;
|
||||
ThrottleOutPacketTypeFlags categories = (ThrottleOutPacketTypeFlags)o;
|
||||
QueueEmpty callback = OnQueueEmpty;
|
||||
|
||||
// if (m_udpServer.IsRunningOutbound)
|
||||
// {
|
||||
ThrottleOutPacketTypeFlags categories = (ThrottleOutPacketTypeFlags)o;
|
||||
QueueEmpty callback = OnQueueEmpty;
|
||||
|
||||
if (callback != null)
|
||||
{
|
||||
// if (m_udpServer.IsRunningOutbound)
|
||||
// {
|
||||
try { callback(categories); }
|
||||
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;
|
||||
|
||||
// }
|
||||
if (callback != null)
|
||||
{
|
||||
// if (m_udpServer.IsRunningOutbound)
|
||||
// {
|
||||
try { callback(categories); }
|
||||
catch (Exception e) { m_log.Error("[LLUDPCLIENT]: OnQueueEmpty(" + categories + ") threw an exception: " + e.Message, e); }
|
||||
// }
|
||||
}
|
||||
|
||||
m_isQueueEmptyRunning = false;
|
||||
}
|
||||
|
||||
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>
|
||||
|
|
|
@ -1705,5 +1705,10 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
|||
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)
|
||||
{
|
||||
return new byte[0];
|
||||
|
|
Loading…
Reference in New Issue