]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/configreader.cpp
Don't bind ports after an unsuccessful rehash
[user/henk/code/inspircd.git] / src / configreader.cpp
index 56aab671fe54c29f13364e8e695954e00fa98596..b3caf8c7501146e7afdac5d80d0ed42c6f877234 100644 (file)
@@ -35,6 +35,7 @@
 #endif
 
 ServerConfig::ServerConfig()
+       : NoSnoticeStack(false)
 {
        WhoWasGroupSize = WhoWasMaxGroups = WhoWasMaxKeep = 0;
        RawLog = NoUserDns = HideBans = HideSplits = UndernetMsgPrefix = false;
@@ -48,6 +49,14 @@ ServerConfig::ServerConfig()
        OperMaxChans = 30;
        c_ipv4_range = 32;
        c_ipv6_range = 128;
+
+       std::vector<KeyVal>* items;
+       EmptyTag = ConfigTag::create("empty", "<auto>", 0, items);
+}
+
+ServerConfig::~ServerConfig()
+{
+       delete EmptyTag;
 }
 
 void ServerConfig::Update005()
@@ -389,7 +398,7 @@ void ServerConfig::CrossCheckConnectBlocks(ServerConfig* current)
                                throw CoreException("Two connect classes with name \"" + name + "\" defined!");
                        names[name] = i;
 
-                       ConnectClass* me = parent ? 
+                       ConnectClass* me = parent ?
                                new ConnectClass(tag, type, mask, *parent) :
                                new ConnectClass(tag, type, mask);
 
@@ -471,7 +480,7 @@ static const Deprecated ChangedConfig[] = {
        {"die",     "value",            "you need to reread your config"},
        {"bind",    "transport",                "has been moved to <bind:ssl> as of 2.0a1"},
        {"link",    "transport",                "has been moved to <link:ssl> as of 2.0a1"},
-       
+       {"link",        "autoconnect",          "2.0+ does not use the autoconnect value. Please define <autoconnect> tags instead."},
 };
 
 void ServerConfig::Fill()
@@ -554,7 +563,8 @@ void ServerConfig::Fill()
        WelcomeNotice = options->getBool("welcomenotice", true);
 
        range(SoftLimit, 10, ServerInstance->SE->GetMaxFds(), ServerInstance->SE->GetMaxFds(), "<performance:softlimit>");
-       range(MaxConn, 0, SOMAXCONN, SOMAXCONN, "<performance:somaxconn>");
+       if (ConfValue("performance")->getBool("limitsomaxconn", true))
+               range(MaxConn, 0, SOMAXCONN, SOMAXCONN, "<performance:somaxconn>");
        range(MaxTargets, 1, 31, 20, "<security:maxtargets>");
        range(NetBufferSize, 1024, 65534, 10240, "<performance:netbuffersize>");
        range(WhoWasGroupSize, 0, 10000, 10, "<whowas:groupsize>");
@@ -648,8 +658,6 @@ void ServerConfig::Fill()
                OperSpyWhois = SPYWHOIS_SINGLEMSG;
        else
                OperSpyWhois = SPYWHOIS_NONE;
-
-       Limits.Finalise();
 }
 
 // WARNING: it is not safe to use most of the codebase in this function, as it
@@ -722,7 +730,7 @@ void ServerConfig::Apply(ServerConfig* old, const std::string &useruid)
        if (valid)
                ServerInstance->WritePID(this->PID);
 
-       if (old)
+       if (old && valid)
        {
                // On first run, ports are bound later on
                FailedPortList pl;
@@ -744,7 +752,10 @@ void ServerConfig::Apply(ServerConfig* old, const std::string &useruid)
        User* user = useruid.empty() ? NULL : ServerInstance->FindNick(useruid);
 
        if (!valid)
+       {
                ServerInstance->Logs->Log("CONFIG",DEFAULT, "There were errors in your configuration file:");
+               Classes.clear();
+       }
 
        while (errstr.good())
        {
@@ -886,7 +897,7 @@ ConfigTag* ServerConfig::ConfValue(const std::string &tag)
 {
        ConfigTagList found = config_data.equal_range(tag);
        if (found.first == found.second)
-               return NULL;
+               return EmptyTag;
        ConfigTag* rv = found.first->second;
        found.first++;
        if (found.first != found.second)