From bca02499dc04531d15ca83fd697870d9e177b282 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Thu, 4 Nov 2010 15:22:11 -0700 Subject: [PATCH] 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. --- .../RegionSyncClientModule.cs | 4 +-- .../ScriptEngineToSceneConnectorModule.cs | 27 +++++++++++++++++-- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncClientModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncClientModule.cs index e207d2ae7c..4129f1e884 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncClientModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncClientModule.cs @@ -59,9 +59,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule m_active = false; if (syncConfig == null) 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."); - 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."); else { diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/ScriptEngineToSceneConnectorModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/ScriptEngineToSceneConnectorModule.cs index 6eb2bfef3f..1f7c23ca6a 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/ScriptEngineToSceneConnectorModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/ScriptEngineToSceneConnectorModule.cs @@ -79,6 +79,28 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //Read in configuration 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") { scene.RegionSyncEnabled = true; @@ -88,12 +110,13 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule scene.RegionSyncEnabled = false; } - m_regionSyncMode = syncConfig.GetString("Mode", "").ToLower(); - if (syncConfig == null || m_regionSyncMode != "script_engine") + m_regionSyncMode = syncConfig.GetString("Mode", ""); + 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."); return; } + * */ //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