]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/server.cpp
This should save 128 bytes per user for non-opers. Well worth it imho for a reasonabl...
[user/henk/code/inspircd.git] / src / server.cpp
index f4f71d4719d46e99abd952160d2ea56abbd7c7fb..4814852c499bfc31f570108eb6ed0b50a4b76fe6 100644 (file)
@@ -2,11 +2,11 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
  * See: http://www.inspircd.org/wiki/index.php/Credits
  *
  * This program is free but copyrighted software; see
- *            the file COPYING for details.
+ *         the file COPYING for details.
  *
  * ---------------------------------------------------
  */
@@ -46,26 +46,31 @@ void InspIRCd::Exit(int status)
 
 void InspIRCd::Rehash()
 {
-       this->WriteOpers("*** Rehashing config file %s due to SIGHUP",ServerConfig::CleanFilename(this->ConfigFileName));
-       this->CloseLog();
-       if (!this->OpenLog(this->Config->argv, this->Config->argc))
-               this->WriteOpers("*** ERROR: Could not open logfile %s: %s", Config->logpath.c_str(), strerror(errno));
+       this->SNO->WriteToSnoMask('A', "Rehashing config file %s due to SIGHUP",ServerConfig::CleanFilename(this->ConfigFileName));
        this->RehashUsersAndChans();
        FOREACH_MOD_I(this, I_OnGarbageCollect, OnGarbageCollect());
-       /*this->Config->Read(false,NULL);*/
-       this->ResetMaxBans();
-       this->Res->Rehash();
-       FOREACH_MOD_I(this,I_OnRehash,OnRehash(NULL,""));
-       this->BuildISupport();
+       if (!this->ConfigThread)
+       {
+               Config->RehashUser = NULL;
+               Config->RehashParameter = "";
+
+               ConfigThread = new ConfigReaderThread(this, false, NULL);
+               Threads->Create(ConfigThread);
+       }
 }
 
 void InspIRCd::RehashServer()
 {
-       this->WriteOpers("*** Rehashing config file");
+       this->SNO->WriteToSnoMask('A', "Rehashing config file");
        this->RehashUsersAndChans();
-       /*this->Config->Read(false,NULL);*/
-       this->ResetMaxBans();
-       this->Res->Rehash();
+       if (!this->ConfigThread)
+       {
+               Config->RehashUser = NULL;
+               Config->RehashParameter = "";
+
+               ConfigThread = new ConfigReaderThread(this, false, NULL);
+               Threads->Create(ConfigThread);
+       }
 }
 
 std::string InspIRCd::GetVersionString()
@@ -77,7 +82,7 @@ std::string InspIRCd::GetVersionString()
        }
        else
        {
-               snprintf(versiondata,MAXBUF,"%s %s :%s [FLAGS=%s,%s,%d]",VERSION,Config->ServerName,SYSTEM,REVISION,SE->GetName().c_str(),Config->sid);
+               snprintf(versiondata,MAXBUF,"%s %s :%s [FLAGS=%s,%s,%s]",VERSION,Config->ServerName,SYSTEM,REVISION,SE->GetName().c_str(),Config->sid);
        }
        return versiondata;
 }
@@ -106,7 +111,7 @@ void InspIRCd::AddServerName(const std::string &servername)
                if(**itr == servername)
                        return;
 
-       string * ns = new string(servername);
+       std::string * ns = new std::string(servername);
        servernames.push_back(ns);
 }
 
@@ -117,7 +122,7 @@ const char* InspIRCd::FindServerNamePtr(const std::string &servername)
                if(**itr == servername)
                        return (*itr)->c_str();
 
-       servernames.push_back(new string(servername));
+       servernames.push_back(new std::string(servername));
        itr = --servernames.end();
        return (*itr)->c_str();
 }