diff options
author | attilamolnar <attilamolnar@hush.com> | 2013-09-08 17:21:01 +0200 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2013-09-08 17:21:01 +0200 |
commit | deb18ee9cfa531a87141aea61171c6899ef7d687 (patch) | |
tree | 1ec3176daed470b8b44e08b7bbc2f861457a9368 | |
parent | 992674362c5f64bdb8e1942eeaa7612524529cd6 (diff) |
Remove InspIRCd::HandleRehash functor
Call InspIRCd::Rehash() from cmd_rehash and from the SIGHUP handler
-rw-r--r-- | include/inspircd.h | 9 | ||||
-rw-r--r-- | src/commands/cmd_rehash.cpp | 6 | ||||
-rw-r--r-- | src/inspircd.cpp | 1 | ||||
-rw-r--r-- | src/server.cpp | 9 |
4 files changed, 7 insertions, 18 deletions
diff --git a/include/inspircd.h b/include/inspircd.h index 2e4b02fac..f43141c38 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -245,7 +245,6 @@ DEFINE_HANDLER1(IsNickHandler, bool, const std::string&); DEFINE_HANDLER2(GenRandomHandler, void, char*, size_t); DEFINE_HANDLER1(IsIdentHandler, bool, const std::string&); DEFINE_HANDLER1(IsChannelHandler, bool, const std::string&); -DEFINE_HANDLER1(RehashHandler, void, const std::string&); DEFINE_HANDLER3(OnCheckExemptionHandler, ModResult, User*, Channel*, const std::string&); /** The main class of the irc server. @@ -296,7 +295,6 @@ class CoreExport InspIRCd IsIdentHandler HandleIsIdent; OnCheckExemptionHandler HandleOnCheckExemption; IsChannelHandler HandleIsChannel; - RehashHandler HandleRehash; GenRandomHandler HandleGenRandom; /** Globally accessible fake user record. This is used to force mode changes etc across s2s, etc.. bit ugly, but.. better than how this was done in 1.1 @@ -483,10 +481,6 @@ class CoreExport InspIRCd */ static bool IsSID(const std::string& sid); - /** Rehash the local server - */ - caller1<void, const std::string&> Rehash; - /** Handles incoming signals after being set * @param signal the signal recieved */ @@ -583,8 +577,9 @@ class CoreExport InspIRCd static void ProcessColors(file_cache& input); /** Rehash the local server + * @param uuid The uuid of the user who started the rehash, can be empty */ - void RehashServer(); + void Rehash(const std::string& uuid = ""); /** Check if the given nickmask matches too many users, send errors to the given user * @param nick A nickmask to match against diff --git a/src/commands/cmd_rehash.cpp b/src/commands/cmd_rehash.cpp index 3dc454036..441ddbd2a 100644 --- a/src/commands/cmd_rehash.cpp +++ b/src/commands/cmd_rehash.cpp @@ -88,11 +88,7 @@ CmdResult CommandRehash::Handle (const std::vector<std::string>& parameters, Use /* Don't do anything with the logs here -- logs are restarted * after the config thread has completed. */ - FOREACH_MOD(OnGarbageCollect, ()); - - - ServerInstance->ConfigThread = new ConfigReaderThread(user->uuid); - ServerInstance->Threads->Start(ServerInstance->ConfigThread); + ServerInstance->Rehash(); } else { diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 2171e2a9f..8336a4847 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -234,7 +234,6 @@ InspIRCd::InspIRCd(int argc, char** argv) : OperQuit("operquit", NULL), GenRandom(&HandleGenRandom), IsChannel(&HandleIsChannel), - Rehash(&HandleRehash), IsNick(&HandleIsNick), IsIdent(&HandleIsIdent), OnCheckExemption(&HandleOnCheckExemption) diff --git a/src/server.cpp b/src/server.cpp index 97b4058c0..4f58c881d 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -31,7 +31,8 @@ void InspIRCd::SignalHandler(int signal) #else if (signal == SIGHUP) { - Rehash("Caught SIGHUP"); + ServerInstance->SNO->WriteGlobalSno('a', "Rehashing due to SIGHUP"); + Rehash(); } else if (signal == SIGTERM) #endif @@ -55,13 +56,11 @@ void InspIRCd::Exit(int status) exit (status); } -void RehashHandler::Call(const std::string &reason) +void InspIRCd::Rehash(const std::string& uuid) { - ServerInstance->SNO->WriteToSnoMask('a', "Rehashing config file %s %s",ServerConfig::CleanFilename(ServerInstance->ConfigFileName.c_str()), reason.c_str()); - FOREACH_MOD(OnGarbageCollect, ()); if (!ServerInstance->ConfigThread) { - ServerInstance->ConfigThread = new ConfigReaderThread(""); + ServerInstance->ConfigThread = new ConfigReaderThread(uuid); ServerInstance->Threads->Start(ServerInstance->ConfigThread); } } |