diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-02-24 14:09:02 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-02-24 14:09:02 +0000 |
commit | d43120ca4a68006811b3645d0d9065ac098ddc65 (patch) | |
tree | 79511f8ab37007b3bb41bc139b26bc3808759d71 | |
parent | feda1f5f9b1046223b3cc109ecfc0d017243a023 (diff) |
First part of my evil empire! BWAHAHAHAHAHAHAH...HAHAHAHA...AHAHAH *cough* err i mean... remote includes (BWAHAHAHA)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9013 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | include/inspircd.h | 23 | ||||
-rw-r--r-- | src/configreader.cpp | 7 | ||||
-rw-r--r-- | src/inspircd.cpp | 19 |
3 files changed, 41 insertions, 8 deletions
diff --git a/include/inspircd.h b/include/inspircd.h index 5f528c16b..a933e5c41 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -232,6 +232,21 @@ DEFINE_HANDLER1(FloodQuitUserHandler, void, User*); class XLineManager; class BanCacheManager; +class ConfigReaderThread : public Thread +{ + InspIRCd* ServerInstance; + public: + ConfigReaderThread(InspIRCd* Instance) : Thread(), ServerInstance(Instance) + { + } + + virtual ~ConfigReaderThread() + { + } + + void Run(); +}; + /** The main class of the irc server. * This class contains instances of all the other classes * in this software, with the exception of the base class, @@ -381,6 +396,14 @@ class CoreExport InspIRCd : public classbase */ SocketEngine* SE; + /** Thread engine, Handles threading where required + */ + ThreadEngine* Threads; + + /** The thread/class used to read config files in REHASH and on startup + */ + ConfigReaderThread* ConfigThread; + /** LogManager handles logging. */ LogManager *Logs; diff --git a/src/configreader.cpp b/src/configreader.cpp index 92d2c9aea..a8c4dbaee 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -2305,3 +2305,10 @@ bool DoneELine(ServerConfig* conf, const char* tag) conf->GetInstance()->XLines->CheckELines(); return true; } + +void ConfigReaderThread::Run() +{ + ServerInstance->Config->Read(true, NULL, 0); + ServerInstance->Config->Read(true, NULL, 1); +} + diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 8999e7ccc..e1c40199a 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -308,6 +308,11 @@ InspIRCd::InspIRCd(int argc, char** argv) SE = SEF->Create(this); delete SEF; + + ThreadEngineFactory* tef = new ThreadEngineFactory(); + this->Threads = tef->Create(this); + delete tef; + this->s_signal = 0; // Create base manager classes early, so nothing breaks @@ -477,15 +482,13 @@ InspIRCd::InspIRCd(int argc, char** argv) SE->RecoverFromFork(); - /* Read config, pass 0. At the end if this pass, - * the Config->IncludeFiles is populated, we call - * Config->StartDownloads to initialize the downlaods of all - * these files. + /* During startup we don't actually initialize this + * in the thread engine. */ - Config->Read(true, NULL, 0); - Config->DoDownloads(); - /* We have all the files we can get, initiate pass 1 */ - Config->Read(true, NULL, 1); + this->ConfigThread = new ConfigReaderThread(this); + ConfigThread->Run(); + delete ConfigThread; + this->ConfigThread = NULL; this->AddServerName(Config->ServerName); |