From 6df113845e5c9cecb69922221f9f2d4c235b1a28 Mon Sep 17 00:00:00 2001 From: Dr Scofield Date: Mon, 10 Nov 2008 17:37:28 +0000 Subject: [PATCH] this changeset adds an option to RemoteAdmin to limit the number of regions that XmlRpcCreateRegion will create: if region_limit is != 0 then XmlRpcCreateRegion will only create a new region if the number of regions already existing is below region_limit. --- .../RemoteController/RemoteAdminPlugin.cs | 7 +++++++ bin/OpenSim.ini.example | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 6f8ec43451..1490893314 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -378,6 +378,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController XmlRpcResponse response = new XmlRpcResponse(); Hashtable responseData = new Hashtable(); + int m_regionLimit = m_config.GetInt("region_limit", 0); + try { Hashtable requestData = (Hashtable) request.Params[0]; @@ -392,6 +394,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController if (!String.IsNullOrEmpty(requiredPassword) && (string)requestData["password"] != requiredPassword) throw new Exception("wrong password"); + // check whether we still have space left (iff we are using limits) + if (m_regionLimit != 0 && m_app.SceneManager.Scenes.Count >= m_regionLimit) + throw new Exception(String.Format("cannot instantiate new region, server capacity {0} already reached; delete regions first", m_regionLimit)); + + // extract or generate region ID now Scene scene = null; UUID regionID = UUID.Zero; diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 8c9ee41c3a..369f940785 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -392,6 +392,12 @@ access_password = unknown region_file_template = "{0}x{1}-{2}.xml" +; we can limit the number of regions that XmlRpcCreateRegion will +;allow by setting this to a positive, non-0 number: as long as the +;number of regions is below region_limits, XmlRpcCreateRegion will +;succeed. setting region_limits to 0 disables the check. +;region_limits = 0 + [RestPlugins] ; Change this to true to enable REST Plugins. This must be true if you wish to use ; REST Region or REST Asset and Inventory Plugins @@ -472,7 +478,6 @@ msgformat = "PRIVMSG {0} : {3} - {1} of {2}" ; [XIRC] ; enabled = false - ; Uncomment the following for experiment in world versioning ; support. This is so experimental at this point that I'm not going ; to explain it further, you'll need to read the source code