From a05be7bd651fb48b522af1ee94e0aa602ceb480a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 31 Oct 2014 21:44:31 +0000 Subject: Add "region set" console command. This current allows one to set two region parameters agent-limit will set the current root agent limit for the region, as also settable through the viewer, though some impose a max setting (e.g. 100). max-agent-limit will set the maximum allowed root agent limit. This can also be set via the MaxAgent parameter in region config. --- OpenSim/Framework/RegionInfo.cs | 12 ++-- .../World/Region/RegionCommandsModule.cs | 74 +++++++++++++++++++++- 2 files changed, 77 insertions(+), 9 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 5911ade..cae5e51 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -127,7 +127,6 @@ namespace OpenSim.Framework private int m_objectCapacity = 0; private int m_maxPrimsPerUser = -1; private int m_linksetCapacity = 0; - private int m_agentCapacity = 0; private string m_regionType = String.Empty; private RegionLightShareData m_windlight = new RegionLightShareData(); protected uint m_httpPort; @@ -351,10 +350,7 @@ namespace OpenSim.Framework get { return m_linksetCapacity; } } - public int AgentCapacity - { - get { return m_agentCapacity; } - } + public int AgentCapacity { get; set; } public byte AccessLevel { @@ -748,7 +744,7 @@ namespace OpenSim.Framework #endregion - m_agentCapacity = config.GetInt("MaxAgents", 100); + AgentCapacity = config.GetInt("MaxAgents", 100); allKeys.Remove("MaxAgents"); // Multi-tenancy @@ -864,8 +860,8 @@ namespace OpenSim.Framework if (m_linksetCapacity > 0) config.Set("LinksetPrims", m_linksetCapacity); - if (m_agentCapacity > 0) - config.Set("MaxAgents", m_agentCapacity); + if (AgentCapacity > 0) + config.Set("MaxAgents", AgentCapacity); if (ScopeID != UUID.Zero) config.Set("ScopeID", ScopeID.ToString()); diff --git a/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs b/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs index c2be5c5..b0caaf9 100644 --- a/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs +++ b/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs @@ -97,6 +97,15 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands "Some parameters can be set with the \"region set\" command.\n" + "Others must be changed via a viewer (usually via the region/estate dialog box).", HandleShowRegion); + + m_console.Commands.AddCommand( + "Regions", false, "region set", + "region get", + "Set control information for the currently selected region.", + "Currently, the following parameters can be set:\n" + + "agent-limit - Current root agent limit.\n" + + "max-agent-limit - Maximum root agent limit. agent-limit cannot exceed this.", + HandleRegionSet); } public void RemoveRegion(Scene scene) @@ -132,8 +141,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands dispList.AddRow("External endpoint", ri.ExternalEndPoint); dispList.AddRow("Internal endpoint", ri.InternalEndPoint); dispList.AddRow("Access level", ri.AccessLevel); + dispList.AddRow("Agent limit", rs.AgentLimit); dispList.AddRow("Max agent limit", ri.AgentCapacity); - dispList.AddRow("Current agent limit", rs.AgentLimit); dispList.AddRow("Linkset capacity", ri.LinksetCapacity <= 0 ? "not set" : ri.LinksetCapacity.ToString()); dispList.AddRow("Prim capacity", ri.ObjectCapacity); dispList.AddRow("Prim bonus", rs.ObjectBonus); @@ -175,6 +184,69 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands MainConsole.Instance.Output(sb.ToString()); } + private void HandleRegionSet(string module, string[] args) + { + if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene)) + return; + + if (args.Length != 4) + { + MainConsole.Instance.OutputFormat("Usage: region set "); + return; + } + + string param = args[2]; + string rawValue = args[3]; + + if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene)) + return; + + RegionInfo ri = m_scene.RegionInfo; + RegionSettings rs = ri.RegionSettings; + + if (param == "agent-limit") + { + int newValue; + + if (!ConsoleUtil.TryParseConsoleNaturalInt(MainConsole.Instance, rawValue, out newValue)) + return; + + if (newValue > ri.AgentCapacity) + { + MainConsole.Instance.OutputFormat( + "Cannot set {0} to {1} in {2} as max-agent-limit is {3}", "agent-limit", + newValue, m_scene.Name, ri.AgentCapacity); + } + else + { + rs.AgentLimit = newValue; + + MainConsole.Instance.OutputFormat( + "{0} set to {1} in {2}", "agent-limit", newValue, m_scene.Name); + } + } + else if (param == "max-agent-limit") + { + int newValue; + + if (!ConsoleUtil.TryParseConsoleNaturalInt(MainConsole.Instance, rawValue, out newValue)) + return; + + ri.AgentCapacity = newValue; + + MainConsole.Instance.OutputFormat( + "{0} set to {1} in {2}", "max-agent-limit", newValue, m_scene.Name); + + if (ri.AgentCapacity < rs.AgentLimit) + { + rs.AgentLimit = ri.AgentCapacity; + + MainConsole.Instance.OutputFormat( + "Reducing {0} to {1} in {2}", "agent-limit", rs.AgentLimit, m_scene.Name); + } + } + } + private void HandleShowScene(string module, string[] cmd) { if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene)) -- cgit v1.1