Allow "debug lludp throttle *" commands to work without a user name, in which case they apply to all users in the lludp server

mb-throttle-test
Justin Clark-Casey (justincc) 2014-10-07 00:03:05 +01:00
parent a142edec03
commit 679eaec22f
1 changed files with 51 additions and 21 deletions

View File

@ -130,7 +130,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
"Debug", "Debug",
false, false,
"debug lludp throttle log", "debug lludp throttle log",
"debug lludp throttle log <level> <avatar-first-name> <avatar-last-name>", "debug lludp throttle log <level> [<avatar-first-name> <avatar-last-name>]",
"Change debug logging level for throttles.", "Change debug logging level for throttles.",
"If level >= 0 then throttle debug logging is performed.\n" "If level >= 0 then throttle debug logging is performed.\n"
+ "If level <= 0 then no throttle debug logging is performed.", + "If level <= 0 then no throttle debug logging is performed.",
@ -140,7 +140,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
"Debug", "Debug",
false, false,
"debug lludp throttle get", "debug lludp throttle get",
"debug lludp throttle get <avatar-first-name> <avatar-last-name>", "debug lludp throttle get [<avatar-first-name> <avatar-last-name>]",
"Return debug settings for throttles.", "Return debug settings for throttles.",
HandleThrottleGetCommand); HandleThrottleGetCommand);
@ -148,7 +148,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
"Debug", "Debug",
false, false,
"debug lludp throttle set", "debug lludp throttle set",
"debug lludp throttle set <param> <value> <avatar-first-name> <avatar-last-name>", "debug lludp throttle set <param> <value> [<avatar-first-name> <avatar-last-name>]",
"Set a throttle parameter for the given client.", "Set a throttle parameter for the given client.",
"Only current setting is 'adaptive' which must be 'true' or 'false'", "Only current setting is 'adaptive' which must be 'true' or 'false'",
HandleThrottleSetCommand); HandleThrottleSetCommand);
@ -278,9 +278,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene) if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene)
return; return;
if (args.Length != 7) bool all = args.Length == 5;
bool one = args.Length == 7;
if (!all && !one)
{ {
MainConsole.Instance.OutputFormat("Usage: debug lludp throttle log <level> <avatar-first-name> <avatar-last-name>"); MainConsole.Instance.OutputFormat(
"Usage: debug lludp throttle log <level> [<avatar-first-name> <avatar-last-name>]");
return; return;
} }
@ -288,12 +292,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (!ConsoleUtil.TryParseConsoleInt(MainConsole.Instance, args[4], out level)) if (!ConsoleUtil.TryParseConsoleInt(MainConsole.Instance, args[4], out level))
return; return;
string firstName = args[5]; string firstName = null;
string lastName = args[6]; string lastName = null;
if (one)
{
firstName = args[5];
lastName = args[6];
}
m_udpServer.Scene.ForEachScenePresence(sp => m_udpServer.Scene.ForEachScenePresence(sp =>
{ {
if (sp.Firstname == firstName && sp.Lastname == lastName) if (all || (sp.Firstname == firstName && sp.Lastname == lastName))
{ {
MainConsole.Instance.OutputFormat( MainConsole.Instance.OutputFormat(
"Throttle log level for {0} ({1}) set to {2} in {3}", "Throttle log level for {0} ({1}) set to {2} in {3}",
@ -309,17 +319,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene) if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene)
return; return;
if (args.Length != 8) bool all = args.Length == 6;
bool one = args.Length == 8;
if (!all && !one)
{ {
MainConsole.Instance.OutputFormat( MainConsole.Instance.OutputFormat(
"Usage: debug lludp throttle set <param> <value> <avatar-first-name> <avatar-last-name>"); "Usage: debug lludp throttle set <param> <value> [<avatar-first-name> <avatar-last-name>]");
return; return;
} }
string param = args[4]; string param = args[4];
string rawValue = args[5]; string rawValue = args[5];
string firstName = args[6];
string lastName = args[7]; string firstName = null;
string lastName = null;
if (one)
{
firstName = args[6];
lastName = args[7];
}
if (param == "adaptive") if (param == "adaptive")
{ {
@ -328,8 +348,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return; return;
m_udpServer.Scene.ForEachScenePresence(sp => m_udpServer.Scene.ForEachScenePresence(sp =>
{ {
if (sp.Firstname == firstName && sp.Lastname == lastName) if (all || (sp.Firstname == firstName && sp.Lastname == lastName))
{ {
MainConsole.Instance.OutputFormat( MainConsole.Instance.OutputFormat(
"Setting param {0} to {1} for {2} ({3}) in {4}", "Setting param {0} to {1} for {2} ({3}) in {4}",
@ -349,18 +369,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene) if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene)
return; return;
if (args.Length != 6) bool all = args.Length == 4;
bool one = args.Length == 6;
if (!all && !one)
{ {
MainConsole.Instance.OutputFormat("Usage: debug lludp throttle get <avatar-first-name> <avatar-last-name>"); MainConsole.Instance.OutputFormat(
"Usage: debug lludp throttle get [<avatar-first-name> <avatar-last-name>]");
return; return;
} }
string firstName = args[4]; string firstName = null;
string lastName = args[5]; string lastName = null;
if (one)
{
firstName = args[4];
lastName = args[5];
}
m_udpServer.Scene.ForEachScenePresence(sp => m_udpServer.Scene.ForEachScenePresence(sp =>
{ {
if (sp.Firstname == firstName && sp.Lastname == lastName) if (all || (sp.Firstname == firstName && sp.Lastname == lastName))
{ {
MainConsole.Instance.OutputFormat( MainConsole.Instance.OutputFormat(
"Status for {0} ({1}) in {2}", "Status for {0} ({1}) in {2}",