diff options
author | Justin Clark-Casey (justincc) | 2014-10-31 21:44:31 +0000 |
---|---|---|
committer | Justin Clark-Casey | 2014-10-31 21:47:12 +0000 |
commit | a05be7bd651fb48b522af1ee94e0aa602ceb480a (patch) | |
tree | 20b43829f2875d4ce64b0a053fc727f8f6f09738 | |
parent | Add "region get" command as a synononym for "show region" console command. (diff) | |
download | opensim-SC_OLD-a05be7bd651fb48b522af1ee94e0aa602ceb480a.zip opensim-SC_OLD-a05be7bd651fb48b522af1ee94e0aa602ceb480a.tar.gz opensim-SC_OLD-a05be7bd651fb48b522af1ee94e0aa602ceb480a.tar.bz2 opensim-SC_OLD-a05be7bd651fb48b522af1ee94e0aa602ceb480a.tar.xz |
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.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/RegionInfo.cs | 12 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs | 74 |
2 files changed, 77 insertions, 9 deletions
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 | |||
127 | private int m_objectCapacity = 0; | 127 | private int m_objectCapacity = 0; |
128 | private int m_maxPrimsPerUser = -1; | 128 | private int m_maxPrimsPerUser = -1; |
129 | private int m_linksetCapacity = 0; | 129 | private int m_linksetCapacity = 0; |
130 | private int m_agentCapacity = 0; | ||
131 | private string m_regionType = String.Empty; | 130 | private string m_regionType = String.Empty; |
132 | private RegionLightShareData m_windlight = new RegionLightShareData(); | 131 | private RegionLightShareData m_windlight = new RegionLightShareData(); |
133 | protected uint m_httpPort; | 132 | protected uint m_httpPort; |
@@ -351,10 +350,7 @@ namespace OpenSim.Framework | |||
351 | get { return m_linksetCapacity; } | 350 | get { return m_linksetCapacity; } |
352 | } | 351 | } |
353 | 352 | ||
354 | public int AgentCapacity | 353 | public int AgentCapacity { get; set; } |
355 | { | ||
356 | get { return m_agentCapacity; } | ||
357 | } | ||
358 | 354 | ||
359 | public byte AccessLevel | 355 | public byte AccessLevel |
360 | { | 356 | { |
@@ -748,7 +744,7 @@ namespace OpenSim.Framework | |||
748 | 744 | ||
749 | #endregion | 745 | #endregion |
750 | 746 | ||
751 | m_agentCapacity = config.GetInt("MaxAgents", 100); | 747 | AgentCapacity = config.GetInt("MaxAgents", 100); |
752 | allKeys.Remove("MaxAgents"); | 748 | allKeys.Remove("MaxAgents"); |
753 | 749 | ||
754 | // Multi-tenancy | 750 | // Multi-tenancy |
@@ -864,8 +860,8 @@ namespace OpenSim.Framework | |||
864 | if (m_linksetCapacity > 0) | 860 | if (m_linksetCapacity > 0) |
865 | config.Set("LinksetPrims", m_linksetCapacity); | 861 | config.Set("LinksetPrims", m_linksetCapacity); |
866 | 862 | ||
867 | if (m_agentCapacity > 0) | 863 | if (AgentCapacity > 0) |
868 | config.Set("MaxAgents", m_agentCapacity); | 864 | config.Set("MaxAgents", AgentCapacity); |
869 | 865 | ||
870 | if (ScopeID != UUID.Zero) | 866 | if (ScopeID != UUID.Zero) |
871 | config.Set("ScopeID", ScopeID.ToString()); | 867 | 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 | |||
97 | "Some parameters can be set with the \"region set\" command.\n" | 97 | "Some parameters can be set with the \"region set\" command.\n" |
98 | + "Others must be changed via a viewer (usually via the region/estate dialog box).", | 98 | + "Others must be changed via a viewer (usually via the region/estate dialog box).", |
99 | HandleShowRegion); | 99 | HandleShowRegion); |
100 | |||
101 | m_console.Commands.AddCommand( | ||
102 | "Regions", false, "region set", | ||
103 | "region get", | ||
104 | "Set control information for the currently selected region.", | ||
105 | "Currently, the following parameters can be set:\n" | ||
106 | + "agent-limit <int> - Current root agent limit.\n" | ||
107 | + "max-agent-limit <int> - Maximum root agent limit. agent-limit cannot exceed this.", | ||
108 | HandleRegionSet); | ||
100 | } | 109 | } |
101 | 110 | ||
102 | public void RemoveRegion(Scene scene) | 111 | public void RemoveRegion(Scene scene) |
@@ -132,8 +141,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
132 | dispList.AddRow("External endpoint", ri.ExternalEndPoint); | 141 | dispList.AddRow("External endpoint", ri.ExternalEndPoint); |
133 | dispList.AddRow("Internal endpoint", ri.InternalEndPoint); | 142 | dispList.AddRow("Internal endpoint", ri.InternalEndPoint); |
134 | dispList.AddRow("Access level", ri.AccessLevel); | 143 | dispList.AddRow("Access level", ri.AccessLevel); |
144 | dispList.AddRow("Agent limit", rs.AgentLimit); | ||
135 | dispList.AddRow("Max agent limit", ri.AgentCapacity); | 145 | dispList.AddRow("Max agent limit", ri.AgentCapacity); |
136 | dispList.AddRow("Current agent limit", rs.AgentLimit); | ||
137 | dispList.AddRow("Linkset capacity", ri.LinksetCapacity <= 0 ? "not set" : ri.LinksetCapacity.ToString()); | 146 | dispList.AddRow("Linkset capacity", ri.LinksetCapacity <= 0 ? "not set" : ri.LinksetCapacity.ToString()); |
138 | dispList.AddRow("Prim capacity", ri.ObjectCapacity); | 147 | dispList.AddRow("Prim capacity", ri.ObjectCapacity); |
139 | dispList.AddRow("Prim bonus", rs.ObjectBonus); | 148 | dispList.AddRow("Prim bonus", rs.ObjectBonus); |
@@ -175,6 +184,69 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
175 | MainConsole.Instance.Output(sb.ToString()); | 184 | MainConsole.Instance.Output(sb.ToString()); |
176 | } | 185 | } |
177 | 186 | ||
187 | private void HandleRegionSet(string module, string[] args) | ||
188 | { | ||
189 | if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene)) | ||
190 | return; | ||
191 | |||
192 | if (args.Length != 4) | ||
193 | { | ||
194 | MainConsole.Instance.OutputFormat("Usage: region set <param> <value>"); | ||
195 | return; | ||
196 | } | ||
197 | |||
198 | string param = args[2]; | ||
199 | string rawValue = args[3]; | ||
200 | |||
201 | if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene)) | ||
202 | return; | ||
203 | |||
204 | RegionInfo ri = m_scene.RegionInfo; | ||
205 | RegionSettings rs = ri.RegionSettings; | ||
206 | |||
207 | if (param == "agent-limit") | ||
208 | { | ||
209 | int newValue; | ||
210 | |||
211 | if (!ConsoleUtil.TryParseConsoleNaturalInt(MainConsole.Instance, rawValue, out newValue)) | ||
212 | return; | ||
213 | |||
214 | if (newValue > ri.AgentCapacity) | ||
215 | { | ||
216 | MainConsole.Instance.OutputFormat( | ||
217 | "Cannot set {0} to {1} in {2} as max-agent-limit is {3}", "agent-limit", | ||
218 | newValue, m_scene.Name, ri.AgentCapacity); | ||
219 | } | ||
220 | else | ||
221 | { | ||
222 | rs.AgentLimit = newValue; | ||
223 | |||
224 | MainConsole.Instance.OutputFormat( | ||
225 | "{0} set to {1} in {2}", "agent-limit", newValue, m_scene.Name); | ||
226 | } | ||
227 | } | ||
228 | else if (param == "max-agent-limit") | ||
229 | { | ||
230 | int newValue; | ||
231 | |||
232 | if (!ConsoleUtil.TryParseConsoleNaturalInt(MainConsole.Instance, rawValue, out newValue)) | ||
233 | return; | ||
234 | |||
235 | ri.AgentCapacity = newValue; | ||
236 | |||
237 | MainConsole.Instance.OutputFormat( | ||
238 | "{0} set to {1} in {2}", "max-agent-limit", newValue, m_scene.Name); | ||
239 | |||
240 | if (ri.AgentCapacity < rs.AgentLimit) | ||
241 | { | ||
242 | rs.AgentLimit = ri.AgentCapacity; | ||
243 | |||
244 | MainConsole.Instance.OutputFormat( | ||
245 | "Reducing {0} to {1} in {2}", "agent-limit", rs.AgentLimit, m_scene.Name); | ||
246 | } | ||
247 | } | ||
248 | } | ||
249 | |||
178 | private void HandleShowScene(string module, string[] cmd) | 250 | private void HandleShowScene(string module, string[] cmd) |
179 | { | 251 | { |
180 | if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene)) | 252 | if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene)) |