From 7bf59c551e60736303921b69812378329be3539a Mon Sep 17 00:00:00 2001 From: Arthur Valadares Date: Thu, 23 Jul 2009 16:57:41 +0000 Subject: * Updates RESTInterregionComms and LocalInterregionComms to the new region module interface. This fixes an issue where region references were being added but weren't being deleted, causing those "unnotified circuit" messages. * Also fixes tests accordingly - Fixes Mantis #3452 - Fixes Mantis #3388 - Fixes Mantis #3871 - Related to Mantis #3493 --- .../Resources/CoreModulePlugin.addin.xml | 2 + .../Interregion/LocalInterregionComms.cs | 61 +++++++++++++---- .../Interregion/RESTInterregionComms.cs | 80 +++++++++++++--------- 3 files changed, 94 insertions(+), 49 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml index f910550..c0932bd 100644 --- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml +++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml @@ -30,6 +30,8 @@ + + diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs index 9af0f66..712a12b 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs @@ -36,7 +36,7 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion { - public class LocalInterregionComms : IRegionModule, IInterregionCommsOut, IInterregionCommsIn + public class LocalInterregionComms : ISharedRegionModule, IInterregionCommsOut, IInterregionCommsIn { private bool m_enabled = false; @@ -50,7 +50,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion #region IRegionModule - public void Initialise(Scene scene, IConfigSource config) + public void Initialise(IConfigSource config) { if (m_sceneList.Count == 0) { @@ -62,30 +62,61 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion m_enabled = true; } } + } - if (!m_enabled) - return; + public void PostInitialise() + { + } - Init(scene); + public void AddRegion(Scene scene) + { } - public void PostInitialise() + public void RemoveRegion(Scene scene) { + if (m_enabled) + { + RemoveScene(scene); + } + } + + public void RegionLoaded(Scene scene) + { + if (m_enabled) + { + Init(scene); + } } public void Close() { } + public Type ReplacableInterface + { + get { return null; } + } + public string Name { get { return "LocalInterregionCommsModule"; } } - public bool IsSharedModule + /// + /// Can be called from other modules. + /// + /// + public void RemoveScene(Scene scene) { - get { return true; } + lock (m_sceneList) + { + if (m_sceneList.Contains(scene)) + { + m_sceneList.Remove(scene); + } + } } + /// /// Can be called from other modules. /// @@ -110,21 +141,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion #region IInterregionComms /** - * Agent-related communications + * Agent-related communications */ public bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, out string reason) { foreach (Scene s in m_sceneList) - { + { if (s.RegionInfo.RegionHandle == regionHandle) { // m_log.DebugFormat("[LOCAL COMMS]: Found region {0} to send SendCreateChildAgent", regionHandle); return s.NewUserConnection(aCircuit, out reason); } } - + // m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for SendCreateChildAgent", regionHandle); reason = "Did not find region."; return false; @@ -137,14 +168,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion if (s.RegionInfo.RegionHandle == regionHandle) { //m_log.DebugFormat( - // "[LOCAL COMMS]: Found region {0} {1} to send ChildAgentUpdate", + // "[LOCAL COMMS]: Found region {0} {1} to send ChildAgentUpdate", // s.RegionInfo.RegionName, regionHandle); - + s.IncomingChildAgentDataUpdate(cAgentData); return true; } } - + // m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for ChildAgentUpdate", regionHandle); return false; } @@ -218,7 +249,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion } /** - * Object-related communications + * Object-related communications */ public bool SendCreateObject(ulong regionHandle, SceneObjectGroup sog, bool isLocalCall) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs index 7f9167d..fd5ccee 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs @@ -45,7 +45,7 @@ using OpenSim.Region.Framework.Scenes.Serialization; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion { - public class RESTInterregionComms : IRegionModule, IInterregionCommsOut + public class RESTInterregionComms : ISharedRegionModule, IInterregionCommsOut { private bool initialized = false; private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -64,51 +64,63 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion #region IRegionModule - public virtual void Initialise(Scene scene, IConfigSource config) + public virtual void Initialise(IConfigSource config) { - if (!initialized) - { - initialized = true; - IConfig startupConfig = config.Configs["Communications"]; - - if ((startupConfig == null) - || (startupConfig != null) - && (startupConfig.GetString("InterregionComms", "RESTComms") == "RESTComms")) - { - m_log.Info("[REST COMMS]: Enabling InterregionComms RESTComms module"); - m_enabled = true; - if (config.Configs["Hypergrid"] != null) - m_safemode = config.Configs["Hypergrid"].GetBoolean("safemode", false); + IConfig startupConfig = config.Configs["Communications"]; - InitOnce(scene); - } + if ((startupConfig == null) || ((startupConfig != null) + && (startupConfig.GetString("InterregionComms", "RESTComms") == "RESTComms"))) + { + m_log.Info("[REST COMMS]: Enabling InterregionComms RESTComms module"); + m_enabled = true; + if (config.Configs["Hypergrid"] != null) + m_safemode = config.Configs["Hypergrid"].GetBoolean("safemode", false); } + } - if (!m_enabled) - return; + public virtual void PostInitialise() + { + } - InitEach(scene); + public virtual void Close() + { + } + public void AddRegion(Scene scene) + { } - public virtual void PostInitialise() + public void RemoveRegion(Scene scene) { if (m_enabled) - AddHTTPHandlers(); + { + m_localBackend.RemoveScene(scene); + scene.UnregisterModuleInterface(this); + } } - public virtual void Close() + public void RegionLoaded(Scene scene) { + if (m_enabled) + { + if (!initialized) + { + InitOnce(scene); + initialized = true; + AddHTTPHandlers(); + } + InitEach(scene); + } } - public virtual string Name + public Type ReplacableInterface { - get { return "RESTInterregionCommsModule"; } + get { return null; } } - public virtual bool IsSharedModule + public virtual string Name { - get { return true; } + get { return "RESTInterregionCommsModule"; } } protected virtual void InitEach(Scene scene) @@ -137,7 +149,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion #region IInterregionComms /** - * Agent-related communications + * Agent-related communications */ public bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, out string reason) @@ -257,7 +269,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion } /** - * Object-related communications + * Object-related communications */ public bool SendCreateObject(ulong regionHandle, SceneObjectGroup sog, bool isLocalCall) @@ -527,7 +539,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion protected virtual void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, ulong regionHandle) { //m_log.Debug(" >>> DoDelete action:" + action + "; regionHandle:" + regionHandle); - + if (action.Equals("release")) m_localBackend.SendReleaseAgent(regionHandle, id, ""); else @@ -613,7 +625,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion extraStr = args["extra"].AsString(); UUID regionID = m_localBackend.GetRegionID(regionhandle); - SceneObjectGroup sog = null; + SceneObjectGroup sog = null; try { sog = SceneObjectSerializer.FromXml2Format(sogXmlStr); @@ -675,7 +687,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion responsedata["str_response_string"] = result.ToString(); } - #endregion + #endregion #region Misc @@ -707,7 +719,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion UInt64.TryParse(parts[2], out regionHandle); if (parts.Length >= 4) action = parts[3]; - + return true; } } @@ -759,7 +771,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion } - #endregion Misc + #endregion Misc protected class RegionToRegionClient : RegionClient { -- cgit v1.1