]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modmanager_dynamic.cpp
Delink servers using an SSL module that is being reloaded
[user/henk/code/inspircd.git] / src / modmanager_dynamic.cpp
index 9005622603f8d45df04ce87677814f5efe25021c..40bced74a211b89eab9ba4190583812108c938fa 100644 (file)
@@ -44,6 +44,8 @@ bool ModuleManager::Load(const char* filename)
                        dirent* entry = NULL;
                        while (0 != (entry = readdir(library)))
                        {
+                               if (entry->d_name[0] == '.')
+                                       continue;
                                if (InspIRCd::Match(entry->d_name, filename, ascii_case_insensitive_map))
                                {
                                        if (!this->Load(entry->d_name))
@@ -88,12 +90,12 @@ bool ModuleManager::Load(const char* filename)
                {
                        newmod->ModuleSourceFile = filename_str;
                        newmod->ModuleDLLManager = newhandle;
-                       Version v = newmod->GetVersion();
+                       Modules[filename_str] = newmod;
+                       newmod->init();
 
+                       Version v = newmod->GetVersion();
                        ServerInstance->Logs->Log("MODULE", DEFAULT,"New module introduced: %s (Module version %s)%s",
                                filename, newhandle->GetVersion().c_str(), (!(v.Flags & VF_VENDOR) ? " [3rd Party]" : " [Vendor]"));
-
-                       Modules[filename_str] = newmod;
                }
                else
                {
@@ -106,6 +108,8 @@ bool ModuleManager::Load(const char* filename)
        catch (CoreException& modexcept)
        {
                // failure in module constructor
+               if (newmod)
+                       DoSafeUnload(newmod);
                delete newmod;
                delete newhandle;
                LastModuleError = "Unable to load " + filename_str + ": " + modexcept.GetReason();
@@ -165,7 +169,8 @@ namespace {
                        ServerInstance->GlobalCulls.Apply();
                        delete dll;
                        bool rv = ServerInstance->Modules->Load(name.c_str());
-                       callback->Call(rv);
+                       if (callback)
+                               callback->Call(rv);
                        ServerInstance->GlobalCulls.AddItem(this);
                }
        };