* 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
0.6.0-stable
Justin Clarke Casey 2008-10-13 20:35:45 +00:00
parent 3d26ff209d
commit 97f4226666
6 changed files with 67 additions and 7 deletions

View File

@ -290,7 +290,7 @@ namespace OpenSim.Framework
l_EstateManagers.Clear(); l_EstateManagers.Clear();
configMember.performConfigurationRetrieve(); configMember.performConfigurationRetrieve();
} }
catch (Exception e) catch (Exception)
{ {
} }
} }

View File

@ -34,6 +34,7 @@ namespace OpenSim.Framework
public static uint DefaultHttpPort = 8001; public static uint DefaultHttpPort = 8001;
public string AllowForcefulBanlines = "TRUE"; public string AllowForcefulBanlines = "TRUE";
public bool AllowRegionRegistration = true;
public string AssetRecvKey = String.Empty; public string AssetRecvKey = String.Empty;
public string AssetSendKey = String.Empty; public string AssetSendKey = String.Empty;
@ -90,7 +91,13 @@ namespace OpenSim.Framework
configMember.addConfigurationOption("allow_forceful_banlines", configMember.addConfigurationOption("allow_forceful_banlines",
ConfigurationOption.ConfigurationTypes.TYPE_STRING, ConfigurationOption.ConfigurationTypes.TYPE_STRING,
"Allow Forceful Banlines", "TRUE", true); "Allow Forceful Banlines", "TRUE", true);
configMember.addConfigurationOption("allow_region_registration",
ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
"Allow regions to register immediately upon grid server startup? true/false",
"True",
false);
} }
public bool handleIncomingConfiguration(string configuration_key, object configuration_result) public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
@ -133,6 +140,9 @@ namespace OpenSim.Framework
case "allow_forceful_banlines": case "allow_forceful_banlines":
AllowForcefulBanlines = (string) configuration_result; AllowForcefulBanlines = (string) configuration_result;
break; break;
case "allow_region_registration":
AllowRegionRegistration = (bool)configuration_result;
break;
} }
return true; return true;

View File

@ -36,7 +36,7 @@ namespace OpenSim.Framework
{ {
private static readonly PacketPool instance = new PacketPool(); private static readonly PacketPool instance = new PacketPool();
private const bool packetPoolEnabled = false; private bool packetPoolEnabled = false;
private readonly Dictionary<PacketType, Stack<Packet>> pool = new Dictionary<PacketType, Stack<Packet>>(); private readonly Dictionary<PacketType, Stack<Packet>> pool = new Dictionary<PacketType, Stack<Packet>>();

View File

@ -50,7 +50,7 @@ namespace OpenSim.Framework
configMember = new ConfigurationMember(Path.Combine(Util.configDir(), "estate_settings.xml"), "ESTATE SETTINGS", LoadConfigurationOptions, HandleIncomingConfiguration, true); configMember = new ConfigurationMember(Path.Combine(Util.configDir(), "estate_settings.xml"), "ESTATE SETTINGS", LoadConfigurationOptions, HandleIncomingConfiguration, true);
configMember.performConfigurationRetrieve(); configMember.performConfigurationRetrieve();
} }
catch (Exception e) catch (Exception)
{ {
} }
} }

View File

@ -377,6 +377,15 @@ namespace OpenSim.Grid.GridServer
m_log.Warn("[LOGIN PRELUDE]: Invalid login parameters, sending back error response."); m_log.Warn("[LOGIN PRELUDE]: Invalid login parameters, sending back error response.");
return ErrorResponse("Wrong format in login parameters. Please verify parameters." + e.ToString()); 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); m_log.InfoFormat("[LOGIN BEGIN]: Received login request from simulator: {0}", sim.regionName);
@ -1206,6 +1215,20 @@ namespace OpenSim.Grid.GridServer
} }
return response; return response;
} }
/// <summary>
/// Construct an XMLRPC registration disabled response
/// </summary>
/// <param name="error"></param>
/// <returns></returns>
public static XmlRpcResponse XmlRPCRegionRegistrationDisabledResponse(string error)
{
XmlRpcResponse errorResponse = new XmlRpcResponse();
Hashtable errorResponseData = new Hashtable();
errorResponse.Value = errorResponseData;
errorResponseData["restricted"] = error;
return errorResponse;
}
} }
/// <summary> /// <summary>

View File

@ -63,15 +63,42 @@ namespace OpenSim.Grid.GridServer
MainConsole.Instance = m_console; MainConsole.Instance = m_console;
} }
public void managercallback(string cmd) public override void RunCmd(string cmd, string[] cmdparams)
{ {
base.RunCmd(cmd, cmdparams);
switch (cmd) switch (cmd)
{ {
case "shutdown": case "disable-reg":
RunCmd("shutdown", new string[0]); 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; break;
} }
} }
protected override void StartupSpecific() protected override void StartupSpecific()
{ {