From 4314b6115bb1109c1c386cc2d135a9ca472d58e0 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Wed, 19 Dec 2007 10:06:56 +0000 Subject: Stopped module loader from re-loading .dll once for every plugin found within it. --- OpenSim/Region/Environment/ModuleLoader.cs | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region/Environment') diff --git a/OpenSim/Region/Environment/ModuleLoader.cs b/OpenSim/Region/Environment/ModuleLoader.cs index 6893e3f..cfe19cb 100644 --- a/OpenSim/Region/Environment/ModuleLoader.cs +++ b/OpenSim/Region/Environment/ModuleLoader.cs @@ -114,20 +114,26 @@ namespace OpenSim.Region.Environment } /// - /// Loads/initialises a Module instance that can be used by mutliple Regions + /// Loads/initialises a Module instance that can be used by multiple Regions /// /// /// - /// public void LoadSharedModule(string dllName, string moduleName) { IRegionModule module = LoadModule(dllName, moduleName); - if (module != null) + + LoadSharedModule(module); + } + + /// + /// Loads/initialises a Module instance that can be used by multiple Regions + /// + /// + public void LoadSharedModule(IRegionModule module) + { + if (!m_loadedSharedModules.ContainsKey(module.Name)) { - if (!m_loadedSharedModules.ContainsKey(module.Name)) - { - m_loadedSharedModules.Add(module.Name, module); - } + m_loadedSharedModules.Add(module.Name, module); } } @@ -148,7 +154,7 @@ namespace OpenSim.Region.Environment else { m_log.Verbose("MODULES", " [{0}]: Loading Shared Module.", module.Name); - LoadSharedModule(dllName, module.Name); + LoadSharedModule(module); } } } @@ -168,7 +174,6 @@ namespace OpenSim.Region.Environment /// /// /// - /// public IRegionModule LoadModule(string dllName, string moduleName) { IRegionModule[] modules = LoadModules(dllName); @@ -202,7 +207,6 @@ namespace OpenSim.Region.Environment } } - if (pluginAssembly != null) { try @@ -221,9 +225,9 @@ namespace OpenSim.Region.Environment } } } - catch( ReflectionTypeLoadException ) + catch (ReflectionTypeLoadException) { - m_log.Verbose("MODULES", "Could not load types for [{0}].", pluginAssembly.FullName ); + m_log.Verbose("MODULES", "Could not load types for [{0}].", pluginAssembly.FullName); } } -- cgit v1.1