From f7fef5bc3b40cdb1fe84501439f68f0bc51b8263 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 30 Sep 2014 18:41:04 +0100 Subject: [PATCH] Add "debug lludp throttle set" command to allow setting of parameters at runtime Can currently only set adaptive true|false, where adaptive = false --- .../ClientStack/Linden/UDP/LLUDPServer.cs | 51 ++++++++++++++++++- .../ClientStack/Linden/UDP/TokenBucket.cs | 4 +- 2 files changed, 52 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 6e3132289e..259e1ba32d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -779,6 +779,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP "Return status information about throttles.", HandleThrottleStatusCommand); + MainConsole.Instance.Commands.AddCommand( + "Debug", + false, + "debug lludp throttle set", + "debug lludp throttle set ", + "Set a throttle parameter for the given client.", + "Only current setting is 'adaptive' which must be 'true' or 'false'", + HandleThrottleSetCommand); + MainConsole.Instance.Commands.AddCommand( "Debug", 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 "); + 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) { if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != Scene) @@ -865,7 +914,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP string lastName = args[5]; Scene.ForEachScenePresence(sp => - { + { if (sp.Firstname == firstName && sp.Lastname == lastName) { MainConsole.Instance.OutputFormat( diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs index 658d9bbd3c..e4a12bd5b6 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs @@ -340,10 +340,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP public Int64 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; } // //