-IPC::IPC(InspIRCd* Srv) : ServerInstance(Srv)
-{
- /* The IPC pipe is threaded */
- thread = new IPCThread(Srv);
- Srv->Threads->Create(thread);
-}
-
-void IPC::Check()
-{
- switch (thread->GetStatus())
- {
- case 'N':
- /* No-Operation */
- thread->SetResult(0);
- thread->ClearStatus();
- break;
- case '1':
- /* Rehash */
- ServerInstance->Rehash("due to rehash command from GUI");
- thread->SetResult(0);
- thread->ClearStatus();
- break;
- case '2':
- /* Shutdown */
- thread->SetResult(0);
- thread->ClearStatus();
- ServerInstance->Exit(EXIT_STATUS_NOERROR);
- break;
- case '3':
- /* Restart */
- thread->SetResult(0);
- thread->ClearStatus();
- ServerInstance->Restart("Restarting due to command from GUI");
- break;
- }
-}
-
-IPC::~IPC()
-{
- thread->SetExitFlag();
- delete thread;
-}
\ No newline at end of file
+IPC::IPC()\r
+{\r
+ /* The IPC pipe is threaded */\r
+ thread = new IPCThread();\r
+ ServerInstance->Threads->Start(thread);\r
+}\r
+\r
+void IPC::Check()\r
+{\r
+ switch (thread->GetStatus())\r
+ {\r
+ case 'N':\r
+ /* No-Operation */\r
+ thread->SetResult(0);\r
+ thread->ClearStatus();\r
+ break;\r
+ case '1':\r
+ /* Rehash */\r
+ ServerInstance->Rehash("due to rehash command from GUI");\r
+ thread->SetResult(0);\r
+ thread->ClearStatus();\r
+ break;\r
+ case '2':\r
+ /* Shutdown */\r
+ thread->SetResult(0);\r
+ thread->ClearStatus();\r
+ ServerInstance->Exit(EXIT_STATUS_NOERROR);\r
+ break;\r
+ case '3':\r
+ /* Restart */\r
+ thread->SetResult(0);\r
+ thread->ClearStatus();\r
+ ServerInstance->Restart("Restarting due to command from GUI");\r
+ break;\r
+ case '4':\r
+ /* Toggle debug */\r
+ thread->SetResult(0);\r
+ thread->ClearStatus();\r
+ ServerInstance->Config->cmdline.forcedebug = !ServerInstance->Config->cmdline.forcedebug;\r
+ break;\r
+ }\r
+}\r
+\r
+IPC::~IPC()\r
+{\r
+ thread->SetExitFlag();\r
+ delete thread;\r
+}\r