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.
0.6.1-post-fixes
Dr Scofield 2008-11-10 17:37:28 +00:00
parent 2589acc5d1
commit 6df113845e
2 changed files with 13 additions and 1 deletions

View File

@ -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;

View File

@ -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