]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/configreader.cpp
Depreciated ServerInstance->Log() seems to crash configreader on rehash? We should...
[user/henk/code/inspircd.git] / src / configreader.cpp
index cba015ec9b6ee6c3fdf77de8518977ecacd0f578..df7721e826adfe0d4bc5ac327fc3c318d8b49c0e 100644 (file)
@@ -47,7 +47,7 @@ ServerConfig::ServerConfig(InspIRCd* Instance) : ServerInstance(Instance)
        dns_timeout = DieDelay = 5;
        MaxTargets = 20;
        NetBufferSize = 10240;
-       SoftLimit = MAXCLIENTS;
+       SoftLimit = Instance->SE->GetMaxFds();
        MaxConn = SOMAXCONN;
        MaxWhoResults = 0;
        debugging = 0;
@@ -261,10 +261,10 @@ bool ValidateMaxTargets(ServerConfig* conf, const char*, const char*, ValueItem
 
 bool ValidateSoftLimit(ServerConfig* conf, const char*, const char*, ValueItem &data)
 {
-       if ((data.GetInteger() < 1) || (data.GetInteger() > MAXCLIENTS))
+       if ((data.GetInteger() < 1) || (data.GetInteger() > conf->GetInstance()->SE->GetMaxFds()))
        {
-               conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"WARNING: <options:softlimit> value is greater than %d or less than 0, set to %d.",MAXCLIENTS,MAXCLIENTS);
-               data.Set(MAXCLIENTS);
+               conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"WARNING: <options:softlimit> value is greater than %d or less than 0, set to %d.",conf->GetInstance()->SE->GetMaxFds(),conf->GetInstance()->SE->GetMaxFds());
+               data.Set(conf->GetInstance()->SE->GetMaxFds());
        }
        return true;
 }
@@ -741,7 +741,7 @@ void ServerConfig::ReportConfigError(const std::string &errormessage, bool bail,
                        ServerInstance->SNO->WriteToSnoMask('A', "There were errors in the configuration file:");
                        while (start < errors.length())
                        {
-                               ServerInstance->SNO->WriteToSnoMask('A', errors.substr(start, 360).c_str());
+                               ServerInstance->SNO->WriteToSnoMask('A', errors.substr(start, 360));
                                start += 360;
                        }
                }
@@ -767,7 +767,7 @@ void ServerConfig::Read(bool bail, User* user)
 
        /* These tags can occur ONCE or not at all */
        InitialConfig Values[] = {
-               {"options",     "softlimit",    MAXCLIENTS_S,           new ValueContainerUInt (&this->SoftLimit),              DT_INTEGER,  ValidateSoftLimit},
+               {"options",     "softlimit",    "0",                    new ValueContainerUInt (&this->SoftLimit),              DT_INTEGER,  ValidateSoftLimit},
                {"options",     "somaxconn",    SOMAXCONN_S,            new ValueContainerInt  (&this->MaxConn),                DT_INTEGER,  ValidateMaxConn},
                {"options",     "moronbanner",  "Youre banned!",        new ValueContainerChar (this->MoronBanner),             DT_CHARPTR,  NoValidation},
                {"server",      "name",         "",                     new ValueContainerChar (this->ServerName),              DT_HOSTNAME|DT_BOOTONLY, ValidateServerName},
@@ -1145,12 +1145,12 @@ void ServerConfig::Read(bool bail, User* user)
        // write once here, to try it out and make sure its ok
        ServerInstance->WritePID(this->PID);
 
-       ServerInstance->Log(DEFAULT,"Done reading configuration file.");
-
        /* Switch over logfiles */
        ServerInstance->Logs->CloseLogs();
        ServerInstance->Logs->OpenFileLogs();
 
+       ServerInstance->Logs->Log("CONFIG", DEFAULT, "Done reading configuration file.");
+
        /* If we're rehashing, let's load any new modules, and unload old ones
         */
        if (!bail)
@@ -1215,7 +1215,7 @@ void ServerConfig::Read(bool bail, User* user)
                        }
                }
 
-               ServerInstance->Log(DEFAULT,"Successfully unloaded %lu of %lu modules and loaded %lu of %lu modules.",(unsigned long)rem,(unsigned long)removed_modules.size(),(unsigned long)add,(unsigned long)added_modules.size());
+               ServerInstance->Logs->Log("CONFIG", DEFAULT, "Successfully unloaded %lu of %lu modules and loaded %lu of %lu modules.",(unsigned long)rem,(unsigned long)removed_modules.size(),(unsigned long)add,(unsigned long)added_modules.size());
 
                ServerInstance->Threads->Mutex(false);