Add "region set" console command.
This current allows one to set two region parameters agent-limit <int> 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 <int> will set the maximum allowed root agent limit. This can also be set via the MaxAgent parameter in region config.ghosts
parent
fdb902d762
commit
12f50a2798
|
@ -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());
|
||||
|
|
|
@ -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 <int> - Current root agent limit.\n"
|
||||
+ "max-agent-limit <int> - 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 <param> <value>");
|
||||
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))
|
||||
|
|
Loading…
Reference in New Issue