]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Fix issue where the last module to be loaded wasnt unloaded by restart
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Sat, 23 Dec 2006 15:14:54 +0000 (15:14 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Sat, 23 Dec 2006 15:14:54 +0000 (15:14 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6074 e03df62e-2008-0410-955e-edbf42e46eb7

src/inspircd.cpp
src/modules.cpp

index b74fb40468551c035523b9836fda823650dfeff0..876bf7f29fbcbb90c63943ccd061980457232401 100644 (file)
@@ -80,20 +80,20 @@ void InspIRCd::Restart(const std::string &reason)
                /* This calls the constructor and closes the listening socket */
                delete Config->openSockfd[i];
 
-       /* We do this twice, 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.
+       /* 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.
         */
-       for (int tries = 0; tries < 2; tries++)
+       for (int tries = 0; tries < 3; tries++)
        {
                MyModCount = this->GetModuleCount();
                mymodnames.clear();
 
                /* Unload all modules, so they get a chance to clean up their listeners */
-               for (int j = 0; j < ModCount; j++)
+               for (int j = 0; j <= MyModCount; j++)
                        mymodnames.push_back(Config->module_names[j]);
 
-               for (int k = 0; k < MyModCount; k++)
+               for (int k = 0; k <= MyModCount; k++)
                        this->UnloadModule(mymodnames[k].c_str());
        }
 
index 773f87f66336c8b379c64f07a33c246dede70800..8c38914e987102489f68127849b58b6b4bb0dc84 100644 (file)
@@ -328,6 +328,10 @@ std::pair<int,std::string> InspIRCd::GetInterfaceInstanceCount(Module* m)
 const std::string& InspIRCd::GetModuleName(Module* m)
 {
        static std::string nothing = ""; /* Prevent compiler warning */
+
+       if (!this->GetModuleCount())
+               return nothing;
+
        for (int i = 0; i <= this->GetModuleCount(); i++)
        {
                if (this->modules[i] == m)