From d9e9c41e1311d2a3bc11d16d031b0c1f969027e8 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 5 Sep 2010 17:34:51 +0100 Subject: Add m_Enabled pattern to SimianGridConnector --- .../SimianGrid/SimianGridServiceConnector.cs | 42 ++++++++++++++-------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index 9d67ccb..a94620b 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs @@ -60,6 +60,7 @@ namespace OpenSim.Services.Connectors.SimianGrid private string m_serverUrl = String.Empty; private Dictionary m_scenes = new Dictionary(); + private bool m_Enabled = false; #region ISharedRegionModule @@ -72,21 +73,25 @@ namespace OpenSim.Services.Connectors.SimianGrid public string Name { get { return "SimianGridServiceConnector"; } } public void AddRegion(Scene scene) { + if (!m_Enabled) + return; + // Every shared region module has to maintain an indepedent list of // currently running regions lock (m_scenes) m_scenes[scene.RegionInfo.RegionID] = scene; - if (!String.IsNullOrEmpty(m_serverUrl)) - scene.RegisterModuleInterface(this); + scene.RegisterModuleInterface(this); } public void RemoveRegion(Scene scene) { + if (!m_Enabled) + return; + lock (m_scenes) m_scenes.Remove(scene.RegionInfo.RegionID); - if (!String.IsNullOrEmpty(m_serverUrl)) - scene.UnregisterModuleInterface(this); + scene.UnregisterModuleInterface(this); } #endregion ISharedRegionModule @@ -98,20 +103,29 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - IConfig gridConfig = source.Configs["GridService"]; - if (gridConfig != null) + IConfig moduleConfig = source.Configs["Modules"]; + if (moduleConfig != null) { - string serviceUrl = gridConfig.GetString("GridServerURI"); - if (!String.IsNullOrEmpty(serviceUrl)) + string name = moduleConfig.GetString("GridServices", ""); + if (name == Name) { - if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) - serviceUrl = serviceUrl + '/'; - m_serverUrl = serviceUrl; + IConfig gridConfig = source.Configs["GridService"]; + if (gridConfig != null) + { + string serviceUrl = gridConfig.GetString("GridServerURI"); + if (!String.IsNullOrEmpty(serviceUrl)) + { + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; + m_Enabled = true; + } + } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN GRID CONNECTOR]: No GridServerURI specified, disabling connector"); } } - - if (String.IsNullOrEmpty(m_serverUrl)) - m_log.Info("[SIMIAN GRID CONNECTOR]: No GridServerURI specified, disabling connector"); } #region IGridService -- cgit v1.1