From 1ac4f3b4f6cd71f294ddbb9759e1ec9c00139f97 Mon Sep 17 00:00:00 2001 From: Daniel De Graaf Date: Mon, 22 Mar 2010 11:39:10 -0500 Subject: Move ModuleManager::UnloadAll out of modmanager_dynamic --- src/modules.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/modules.cpp') diff --git a/src/modules.cpp b/src/modules.cpp index 4ba9879b0..476e1f594 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -377,6 +377,29 @@ void ModuleManager::DoSafeUnload(Module* mod) ServerInstance->BuildISupport(); } +void ModuleManager::UnloadAll() +{ + /* We do this more than once, so that any service providers get a + * chance to be unhooked by the modules using them, but then get + * a chance to be removed themsleves. + * + * Note: this deliberately does NOT delete the DLLManager objects + */ + for (int tries = 0; tries < 4; tries++) + { + std::map::iterator i = Modules.begin(); + while (i != Modules.end()) + { + std::map::iterator me = i++; + if (CanUnload(me->second)) + { + DoSafeUnload(me->second); + } + } + ServerInstance->GlobalCulls.Apply(); + } +} + std::string& ModuleManager::LastError() { return LastModuleError; -- cgit v1.3.1-10-gc9f91