*/
#define IS_SINGLE(x,y) ( (*x == y) && (*(x+1) == 0) )
-
-
/** Delete a pointer, and NULL its value
*/
template<typename T> inline void DELETE(T* x)
*/
time_t next_call;
+ /** Set to the current signal recieved
+ */
+ int s_signal;
+
/** Get the current time
* Because this only calls time() once every time around the mainloop,
* it is much faster than calling time() directly.
bool IsChannel(const char *chname);
/** Rehash the local server
- * @param status This value is unused, and required for signal handler functions
*/
- static void Rehash(int status);
+ void Rehash();
+
+ /** Handles incoming signals after being set
+ * @param signal the signal recieved
+ */
+ void SignalHandler(int signal);
+
+ /** Sets the signal recieved
+ * @param signal the signal recieved
+ */
+ static void SetSignal(int signal);
/** Causes the server to exit after unloading modules and
* closing all open file descriptors.
using irc::sockets::insp_sockaddr;
InspIRCd* SI = NULL;
+int* mysig = NULL;
/* Burlex: Moved from exitcodes.h -- due to duplicate symbols */
const char* ExitCodes[] =
{
#ifndef WIN32
signal(SIGALRM, SIG_IGN);
- signal(SIGHUP, InspIRCd::Rehash);
+ signal(SIGHUP, InspIRCd::SetSignal);
signal(SIGPIPE, SIG_IGN);
signal(SIGCHLD, SIG_IGN);
#endif
memset(&server, 0, sizeof(server));
memset(&client, 0, sizeof(client));
+ this->s_signal = 0;
+
this->unregistered_count = 0;
this->clientlist = new user_hash();
/* If any inspsockets closed, remove them */
this->InspSocketCull();
+
+ if (this->s_signal)
+ {
+ this->SignalHandler(s_signal);
+ this->s_signal = 0;
+ }
+
}
void InspIRCd::InspSocketCull()
int main(int argc, char** argv)
{
SI = new InspIRCd(argc, argv);
+ mysig = &SI->s_signal;
SI->Run();
delete SI;
return 0;
{
return time_delta;
}
+
+void InspIRCd::SetSignal(int signal)
+{
+ *mysig = signal;
+}
+
* ---------------------------------------------------
*/
+#include <signal.h>
#include "inspircd.h"
-void InspIRCd::Rehash(int status)
+
+void InspIRCd::SignalHandler(int signal)
+{
+ switch (signal)
+ {
+ case SIGHUP:
+ Rehash();
+ break;
+ }
+}
+
+void InspIRCd::Rehash()
{
-/*
- SI->WriteOpers("*** Rehashing config file %s due to SIGHUP",ServerConfig::CleanFilename(SI->ConfigFileName));
- SI->CloseLog();
- SI->OpenLog(SI->Config->argv, SI->Config->argc);
- SI->RehashUsersAndChans();
- FOREACH_MOD_I(SI, I_OnGarbageCollect, OnGarbageCollect());
- SI->Config->Read(false,NULL);
- SI->ResetMaxBans();
- SI->Res->Rehash();
- FOREACH_MOD_I(SI,I_OnRehash,OnRehash(NULL,""));
- SI->BuildISupport();
-*/
+ 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()