]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/inspircd.cpp
Valgrind cleanup: Add RemoveRFCCommands() to dlclose() and delete the core commands
[user/henk/code/inspircd.git] / src / inspircd.cpp
index a1a5d2d032d1fee1b2a6ab3062c893ecc0916b73..28aa0e1b907707016ef8b0de2d9a6f9e03947ad8 100644 (file)
@@ -12,8 +12,8 @@
  */
 
 /* $Core */
-/* $Install: src/inspircd $(BINPATH) */
 #include "inspircd.h"
+#include "inspircd_version.h"
 #include <signal.h>
 
 #ifndef WIN32
@@ -127,7 +127,7 @@ void InspIRCd::Cleanup()
                }
        }
        /* Remove core commands */
-       Parser->RemoveCommands("<core>");
+       Parser->RemoveRFCCommands();
 
        /* Cleanup Server Names */
        for(servernamelist::iterator itr = servernames.begin(); itr != servernames.end(); ++itr)
@@ -378,9 +378,6 @@ InspIRCd::InspIRCd(int argc, char** argv)
        // Initialise TIME
        this->TIME = time(NULL);
 
-       memset(&server, 0, sizeof(server));
-       memset(&client, 0, sizeof(client));
-
        // This must be created first, so other parts of Insp can use it while starting up
        this->Logs = new LogManager(this);
 
@@ -465,7 +462,7 @@ InspIRCd::InspIRCd(int argc, char** argv)
                        default:
                                /* Fall through to handle other weird values too */
                                printf("Unknown parameter '%s'\n", argv[optind-1]);
-                               printf("Usage: %s [--nofork] [--nolog] [--debug] [--logfile <filename>]\n%*s[--runasroot] [--version] [--config <config>] [--testsuite]\n", argv[0], 8+strlen(argv[0]), " ");
+                               printf("Usage: %s [--nofork] [--nolog] [--debug] [--logfile <filename>]\n%*s[--runasroot] [--version] [--config <config>] [--testsuite]\n", argv[0], static_cast<int>(8+strlen(argv[0])), " ");
                                Exit(EXIT_STATUS_ARGV);
                        break;
                }
@@ -495,7 +492,7 @@ InspIRCd::InspIRCd(int argc, char** argv)
        WSAStartup(MAKEWORD(2,0), &wsadata);
        ChangeWindowsSpecificPointers(this);
 #endif
-       strlcpy(Config->MyExecutable,argv[0],MAXBUF);
+       Config->MyExecutable = argv[0];
 
        /* Set the finished argument values */
        Config->nofork = do_nofork;
@@ -536,8 +533,6 @@ InspIRCd::InspIRCd(int argc, char** argv)
        printf_c("\t\033[1;32mpeavey, aquanight, psychon, dz, danieldg\033[0m\n\n");
        printf_c("Others:\t\t\t\033[1;32mSee /INFO Output\033[0m\n");
 
-       Config->ClearStack();
-
        this->Modes = new ModeParser(this);
 
        if (!do_root)
@@ -613,7 +608,6 @@ InspIRCd::InspIRCd(int argc, char** argv)
        this->XLines->CheckELines();
        this->XLines->ApplyLines();
 
-       CheckDie();
        int bounditems = BindPorts(pl);
 
        printf("\n");
@@ -622,7 +616,7 @@ InspIRCd::InspIRCd(int argc, char** argv)
 
        /* Just in case no modules were loaded - fix for bug #101 */
        this->BuildISupport();
-       InitializeDisabledCommands(Config->DisabledCommands, this);
+       Config->ApplyDisabledCommands(Config->DisabledCommands);
 
        if (!pl.empty())
        {
@@ -767,27 +761,9 @@ int InspIRCd::Run()
                        /* Rehash has completed */
                        this->Logs->Log("CONFIG",DEBUG,"Detected ConfigThread exiting, tidying up...");
 
-                       /* Switch over logfiles */
-                       Logs->CloseLogs();
-                       Logs->OpenFileLogs();
-
-                       /*
-                        * Apply the changed configuration from the rehash. This is not done within the
-                        * configuration thread becasuse they may invoke functions that are not threadsafe.
-                        *
-                        * XXX: The order of these is IMPORTANT, do not reorder them without testing
-                        * thoroughly!!!
-                        */
                        this->ConfigThread->Finish();
-                       this->XLines->CheckELines();
-                       this->XLines->ApplyLines();
-                       this->Res->Rehash();
-                       this->ResetMaxBans();
-                       InitializeDisabledCommands(Config->DisabledCommands, this);
-                       User* user = ConfigThread->TheUserUID.empty() ? FindNick(ConfigThread->TheUserUID) : NULL;
-                       FOREACH_MOD_I(this, I_OnRehash, OnRehash(user));
-                       this->BuildISupport();
 
+                       ConfigThread->join();
                        delete ConfigThread;
                        ConfigThread = NULL;
                }