From 83073ebd03e46789b3509af2c4e37ef3b3428174 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Wed, 10 Oct 2012 09:35:08 -0400 Subject: Implement plugin unloading Plugin may be enabled and disabled on the fly. --- OpenSim/Server/Base/PluginManager.cs | 2 ++ OpenSim/Server/Base/ServerUtils.cs | 18 ++++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/OpenSim/Server/Base/PluginManager.cs b/OpenSim/Server/Base/PluginManager.cs index 6248e74..d2cf668 100644 --- a/OpenSim/Server/Base/PluginManager.cs +++ b/OpenSim/Server/Base/PluginManager.cs @@ -246,6 +246,8 @@ namespace OpenSim.Server.Base public bool AddRepository(string repo) { Repositories.RegisterRepository(null, repo, true); + PluginRegistry.Rebuild(null); + return true; } diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index d0b6c81..6cbf332 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -65,6 +65,7 @@ namespace OpenSim.Server.Base uint Configure(IConfigSource config); void Initialize(IHttpServer server); + void Unload(); } public class PluginLoader @@ -105,12 +106,17 @@ namespace OpenSim.Server.Base a = Registry.GetAddin(args.ExtensionNode.Addin.Id); } - m_log.InfoFormat("[SERVER]: Extension Change: {0}/{1}", Registry.DefaultAddinsFolder, a.Name.Replace(',', '.')); - switch(args.Change) { case ExtensionChange.Add: - connector.PluginPath = String.Format("{0}/{1}", Registry.DefaultAddinsFolder, a.Name.Replace(',', '.')); + if (a.AddinFile.Contains(Registry.DefaultAddinsFolder)) + { + connector.PluginPath = String.Format("{0}/{1}", Registry.DefaultAddinsFolder, a.Name.Replace(',', '.')); + } + else + { + connector.PluginPath = a.AddinFile; + } LoadPlugin(connector); break; case ExtensionChange.Remove: @@ -127,15 +133,19 @@ namespace OpenSim.Server.Base if(connector.Enabled) { server = GetServer(connector, port); - m_log.InfoFormat("[SERVER]: Path is {0}", connector.PluginPath); connector.Initialize(server); } else + { m_log.InfoFormat("[SERVER]: {0} Disabled.", connector.ConfigName); + } } private void UnloadPlugin(IRobustConnector connector) { + m_log.InfoFormat("[Server]: Unloading {0}", connector.ConfigName); + + connector.Unload(); } private IHttpServer GetServer(IRobustConnector connector, uint port) -- cgit v1.1