-void InspIRCd::Cleanup()
-{
- if (Config)
- {
- for (unsigned int i = 0; i < Config->ports.size(); i++)
- {
- /* This calls the constructor and closes the listening socket */
- delete Config->ports[i];
- }
-
- Config->ports.clear();
- }
-
- /* Close all client sockets, or the new process inherits them */
- for (std::vector<User*>::const_iterator i = this->Users->local_users.begin(); i != this->Users->local_users.end(); i++)
- {
- (*i)->SetWriteError("Server shutdown");
- (*i)->CloseSocket();
- }
-
- /* We do this more than once, so that any service providers get a
- * chance to be unhooked by the modules using them, but then get
- * a chance to be removed themsleves.
- */
- for (int tries = 0; tries < 3; tries++)
- {
- std::vector<std::string> module_names = Modules->GetAllModuleNames(0);
- for (std::vector<std::string>::iterator k = module_names.begin(); k != module_names.end(); ++k)
- {
- /* Unload all modules, so they get a chance to clean up their listeners */
- this->Modules->Unload(k->c_str());
- }
- }
-
- /* Close logging */
- if (this->Logger)
- this->Logger->Close();
-
-
- /* Cleanup Server Names */
- for(servernamelist::iterator itr = servernames.begin(); itr != servernames.end(); ++itr)
- delete (*itr);
-
-
-}
-
-void InspIRCd::Restart(const std::string &reason)
-{
- /* SendError flushes each client's queue,
- * regardless of writeability state
- */
- this->SendError(reason);
-
- this->Cleanup();
-
- /* Figure out our filename (if theyve renamed it, we're boned) */
- std::string me;
-
-#ifdef WINDOWS
- char module[MAX_PATH];
- if (GetModuleFileName(NULL, module, MAX_PATH))
- me = module;
-#else
- me = Config->MyDir + "/inspircd";
+#ifdef INSPIRCD_ENABLE_TESTSUITE
+/** True if we have been told to run the testsuite from the commandline,
+ * rather than entering the mainloop.
+ */
+static int do_testsuite = 0;