]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/server.cpp
Fix small typo found by danieldg
[user/henk/code/inspircd.git] / src / server.cpp
index 003ed044f7e56c3aaf16d0e16cc6e0035b712dd1..f259e44359a8fefdd02992bceb12e4c4be9b74bd 100644 (file)
  * ---------------------------------------------------
  */
 
+#include <signal.h>
+#include "exitcodes.h"
 #include "inspircd.h"
 
 
+void InspIRCd::SignalHandler(int signal)
+{
+       switch (signal)
+       {
+               case SIGHUP:
+                       Rehash();
+                       break;
+               case SIGTERM:
+                       Exit(signal);
+                       break;
+       }
+}
+
+void InspIRCd::Exit(int status)
+{
+#ifdef WINDOWS
+       delete WindowsIPC;
+#endif
+       if (this)
+       {
+               this->SendError("Exiting with status " + ConvToStr(status) + " (" + std::string(ExitCodes[status]) + ")");
+               this->Cleanup();
+    }
+    exit (status);
+}
+
+void InspIRCd::Rehash()
+{
+       this->WriteOpers("*** Rehashing config file %s due to SIGHUP",ServerConfig::CleanFilename(this->ConfigFileName));
+       this->CloseLog();
+       this->OpenLog(this->Config->argv, this->Config->argc);
+       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();
+}
+
+void InspIRCd::RehashServer()
+{
+       this->WriteOpers("*** Rehashing config file");
+       this->RehashUsersAndChans();
+       this->Config->Read(false,NULL);
+       this->ResetMaxBans();
+       this->Res->Rehash();
+}
+
 std::string InspIRCd::GetVersionString()
 {
        char versiondata[MAXBUF];
@@ -42,7 +93,6 @@ void InspIRCd::BuildISupport()
        Config->Update005();
 }
 
-
 std::string InspIRCd::GetRevision()
 {
        return REVISION;
@@ -80,4 +130,3 @@ bool InspIRCd::FindServerName(const std::string &servername)
        return false;
 }
 
-