Fixed some code in Initialise() in both RegionSyncClientModule and ScriptEngineToSceneConnectorModule, so that OpenSim will not crach if [RegionSyncModule] is not specified or under it, "Enabled" is set.

dsg
Huaiyu (Kitty) Liu 2010-11-04 15:22:11 -07:00
parent 49d7ff0307
commit bca02499dc
2 changed files with 27 additions and 4 deletions

View File

@ -59,9 +59,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
m_active = false; m_active = false;
if (syncConfig == null) if (syncConfig == null)
m_log.Warn("[REGION SYNC CLIENT MODULE] No RegionSyncModule config section found. Shutting down."); m_log.Warn("[REGION SYNC CLIENT MODULE] No RegionSyncModule config section found. Shutting down.");
else if (!syncConfig.GetBoolean("Enabled", true)) else if (!syncConfig.GetBoolean("Enabled", false))
m_log.Warn("[REGION SYNC CLIENT MODULE] RegionSyncModule is not enabled. Shutting down."); m_log.Warn("[REGION SYNC CLIENT MODULE] RegionSyncModule is not enabled. Shutting down.");
else if (!syncConfig.GetString("Mode", "client").ToLower().Equals("client")) else if (!syncConfig.GetString("Mode", "").ToLower().Equals("client"))
m_log.WarnFormat("[REGION SYNC CLIENT MODULE] RegionSyncModule is not in client mode. Shutting down."); m_log.WarnFormat("[REGION SYNC CLIENT MODULE] RegionSyncModule is not in client mode. Shutting down.");
else else
{ {

View File

@ -79,6 +79,28 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//Read in configuration //Read in configuration
IConfig syncConfig = config.Configs["RegionSyncModule"]; IConfig syncConfig = config.Configs["RegionSyncModule"];
if (syncConfig == null)
{
m_log.Warn("[REGION SYNC SCRIPT ENGINE MODULE] No RegionSyncModule config section found. Shutting down.");
return;
}
else if (!syncConfig.GetBoolean("Enabled", false))
{
m_log.Warn("[REGION SYNC SCRIPT ENGINE MODULE] RegionSyncModule is not enabled. Shutting down.");
return;
}
else
{
scene.RegionSyncEnabled = true;
m_regionSyncMode = syncConfig.GetString("Mode", "");
if (m_regionSyncMode == null || m_regionSyncMode.ToLower() != "script_engine")
{
m_log.WarnFormat("[REGION SYNC SCRIPT ENGINE MODULE] RegionSyncModule is not in script_engine mode. Shutting down.");
return;
}
}
/*
if (syncConfig != null && syncConfig.GetString("Enabled", "").ToLower() == "true") if (syncConfig != null && syncConfig.GetString("Enabled", "").ToLower() == "true")
{ {
scene.RegionSyncEnabled = true; scene.RegionSyncEnabled = true;
@ -88,12 +110,13 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
scene.RegionSyncEnabled = false; scene.RegionSyncEnabled = false;
} }
m_regionSyncMode = syncConfig.GetString("Mode", "").ToLower(); m_regionSyncMode = syncConfig.GetString("Mode", "");
if (syncConfig == null || m_regionSyncMode != "script_engine") if (syncConfig == null || m_regionSyncMode == null || m_regionSyncMode.ToLower() != "script_engine")
{ {
m_log.Warn("[REGION SYNC SCRIPT ENGINE MODULE] Not in script_engine mode. Shutting down."); m_log.Warn("[REGION SYNC SCRIPT ENGINE MODULE] Not in script_engine mode. Shutting down.");
return; return;
} }
* */
//get the name of the valid region for script engine, i.e., that region that will holds all objects and scripts //get the name of the valid region for script engine, i.e., that region that will holds all objects and scripts
//if not matching m_scene's name, simply return //if not matching m_scene's name, simply return