diff options
Diffstat (limited to 'src/server.cpp')
-rw-r--r-- | src/server.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/server.cpp b/src/server.cpp index 7f05aee7b..0f931da07 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -12,6 +12,7 @@ */ #include <signal.h> +#include "exitcodes.h" #include "inspircd.h" @@ -22,9 +23,25 @@ void InspIRCd::SignalHandler(int signal) case SIGHUP: Rehash(); break; + case SIGTERM: + Exit(signal); + break; } } +void InspIRCd::Exit(int status) +{ +#ifdef WINDOWS + CloseIPC(); +#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)); |