Add "debug lludp throttle set" command to allow setting of parameters at runtime

Can currently only set adaptive true|false, where adaptive = false
ghosts
Justin Clark-Casey (justincc) 2014-09-30 18:41:04 +01:00
parent 8e5a62c8e7
commit f7fef5bc3b
2 changed files with 52 additions and 3 deletions

View File

@ -779,6 +779,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
"Return status information about throttles.", "Return status information about throttles.",
HandleThrottleStatusCommand); HandleThrottleStatusCommand);
MainConsole.Instance.Commands.AddCommand(
"Debug",
false,
"debug lludp throttle set",
"debug lludp throttle set <param> <value> <avatar-first-name> <avatar-last-name>",
"Set a throttle parameter for the given client.",
"Only current setting is 'adaptive' which must be 'true' or 'false'",
HandleThrottleSetCommand);
MainConsole.Instance.Commands.AddCommand( MainConsole.Instance.Commands.AddCommand(
"Debug", "Debug",
false, false,
@ -850,6 +859,46 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}); });
} }
private void HandleThrottleSetCommand(string module, string[] args)
{
if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != Scene)
return;
if (args.Length != 8)
{
MainConsole.Instance.OutputFormat(
"Usage: debug lludp throttle set <param> <value> <avatar-first-name> <avatar-last-name>");
return;
}
string param = args[4];
string rawValue = args[5];
string firstName = args[6];
string lastName = args[7];
if (param == "adaptive")
{
bool newValue;
if (!ConsoleUtil.TryParseConsoleBool(MainConsole.Instance, rawValue, out newValue))
return;
Scene.ForEachScenePresence(sp =>
{
if (sp.Firstname == firstName && sp.Lastname == lastName)
{
MainConsole.Instance.OutputFormat(
"Setting param {0} to {1} for {2} ({3}) in {4}",
param, newValue, sp.Name, sp.IsChildAgent ? "child" : "root", Scene.Name);
LLUDPClient udpClient = ((LLClientView)sp.ControllingClient).UDPClient;
udpClient.FlowThrottle.Enabled = newValue;
// udpClient.FlowThrottle.MaxDripRate = 0;
// udpClient.FlowThrottle.AdjustedDripRate = 0;
}
});
}
}
private void HandleThrottleStatusCommand(string module, string[] args) private void HandleThrottleStatusCommand(string module, string[] args)
{ {
if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != Scene) if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != Scene)

View File

@ -340,10 +340,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public Int64 MaxDripRate public Int64 MaxDripRate
{ {
get { return (m_maxDripRate == 0 ? m_totalDripRequest : m_maxDripRate); } get { return (m_maxDripRate == 0 ? m_totalDripRequest : m_maxDripRate); }
protected set { m_maxDripRate = (value == 0 ? 0 : Math.Max(value,m_minimumFlow)); } set { m_maxDripRate = (value == 0 ? 0 : Math.Max(value,m_minimumFlow)); }
} }
public bool Enabled { get; private set; } public bool Enabled { get; set; }
// <summary> // <summary>
// //