From 97f4226666b5d3525999550e1362180be182cc87 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Mon, 13 Oct 2008 20:35:45 +0000
Subject: * Apply a modified version of the part of
http://opensimulator.org/mantis/view.php?id=2361 that allows region
registration to be enabled/disabled on the grid server * Region registration
is enabled by default in the configuration unless the user chooses otherwise
* On the console * show status - shows grid status * enable-reg - enables
region registration to the grid * disable-reg - disables region registration
* Enabling or disabling region registration will not affect any other grid functions or regions already on the grid
---
OpenSim/Grid/GridServer/GridManager.cs | 23 +++++++++++++++++++++
OpenSim/Grid/GridServer/GridServerBase.cs | 33 ++++++++++++++++++++++++++++---
2 files changed, 53 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Grid/GridServer')
diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs
index 1e8ac00..7739a55 100644
--- a/OpenSim/Grid/GridServer/GridManager.cs
+++ b/OpenSim/Grid/GridServer/GridManager.cs
@@ -377,6 +377,15 @@ namespace OpenSim.Grid.GridServer
m_log.Warn("[LOGIN PRELUDE]: Invalid login parameters, sending back error response.");
return ErrorResponse("Wrong format in login parameters. Please verify parameters." + e.ToString());
}
+
+ if (!Config.AllowRegionRegistration)
+ {
+ m_log.InfoFormat(
+ "[LOGIN END]: Disabled region registration blocked login request from simulator: {0}",
+ sim.regionName);
+
+ return ErrorResponse("The grid is currently not accepting region registrations.");
+ }
m_log.InfoFormat("[LOGIN BEGIN]: Received login request from simulator: {0}", sim.regionName);
@@ -1206,6 +1215,20 @@ namespace OpenSim.Grid.GridServer
}
return response;
}
+
+ ///
+ /// Construct an XMLRPC registration disabled response
+ ///
+ ///
+ ///
+ public static XmlRpcResponse XmlRPCRegionRegistrationDisabledResponse(string error)
+ {
+ XmlRpcResponse errorResponse = new XmlRpcResponse();
+ Hashtable errorResponseData = new Hashtable();
+ errorResponse.Value = errorResponseData;
+ errorResponseData["restricted"] = error;
+ return errorResponse;
+ }
}
///
diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs
index 2ffeb57..36ea238 100644
--- a/OpenSim/Grid/GridServer/GridServerBase.cs
+++ b/OpenSim/Grid/GridServer/GridServerBase.cs
@@ -63,15 +63,42 @@ namespace OpenSim.Grid.GridServer
MainConsole.Instance = m_console;
}
- public void managercallback(string cmd)
+ public override void RunCmd(string cmd, string[] cmdparams)
{
+ base.RunCmd(cmd, cmdparams);
+
switch (cmd)
{
- case "shutdown":
- RunCmd("shutdown", new string[0]);
+ case "disable-reg":
+ m_config.AllowRegionRegistration = false;
+ m_log.Info("Region registration disabled");
+ break;
+ case "enable-reg":
+ m_config.AllowRegionRegistration = true;
+ m_log.Info("Region registration enabled");
+ break;
+ }
+ }
+
+ public override void Show(string[] showParams)
+ {
+ base.Show(showParams);
+
+ switch (showParams[0])
+ {
+ case "status":
+ if (m_config.AllowRegionRegistration)
+ {
+ m_log.Info("Region registration enabled.");
+ }
+ else
+ {
+ m_log.Info("Region registration disabled.");
+ }
break;
}
}
+
protected override void StartupSpecific()
{
--
cgit v1.1