From 9590e671e6efc5c8da74f22b7038f1ce10501620 Mon Sep 17 00:00:00 2001 From: Dr Scofield Date: Fri, 30 May 2008 12:29:30 +0000 Subject: while investigating why IRCBridgeModule.Close() was having no effect, i noticed that Scene.Close() will only call Close on non-shared region modules. i've now added code to SceneManager.Close() to collect all shared region module from each scene before calling Scene.Close() on it and then, once, all Scenes are closed, go through the list of collected shared region modules and close them as well. SceneManager.Close() is only called when we initiate a shutdown --- i've verified that a Scene restart does not trigger the shutdown of shared modules :-) also, this adds a couple of bug fixes to the IRCBridgeModule (which after all didn't take kindly to being closed) as well as a check to InterregionModule's Close() call. finally, this fixes the RestPlugin's XmlWriter so that it no longer includes the "xsd=..." and "xsi=..." junk. --- OpenSim/Region/Environment/Scenes/SceneManager.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'OpenSim/Region/Environment/Scenes/SceneManager.cs') diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs index c596f6e..dc9ac37 100644 --- a/OpenSim/Region/Environment/Scenes/SceneManager.cs +++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs @@ -32,6 +32,7 @@ using System.Reflection; using libsecondlife; using log4net; using OpenSim.Framework; +using OpenSim.Region.Environment.Interfaces; namespace OpenSim.Region.Environment.Scenes { @@ -78,10 +79,27 @@ namespace OpenSim.Region.Environment.Scenes public void Close() { + // collect known shared modules in sharedModules + Dictionary sharedModules = new Dictionary(); for (int i = 0; i < m_localScenes.Count; i++) { + // extract known shared modules from scene + foreach(string k in m_localScenes[i].Modules.Keys) + { + if (m_localScenes[i].Modules[k].IsSharedModule && + !sharedModules.ContainsKey(k)) + sharedModules[k] = m_localScenes[i].Modules[k]; + } + // close scene/region m_localScenes[i].Close(); } + + // all regions/scenes are now closed, we can now safely + // close all shared modules + foreach(IRegionModule mod in sharedModules.Values) + { + mod.Close(); + } } public void Close(Scene cscene) -- cgit v1.1