X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fextra%2Fm_mysql.cpp;h=06c2a13b6c7e14291f6d9e81e3a3c8d0941c5cee;hb=deb6822302cb9009adc3450dd405817cc0dae9cd;hp=4fbf4f1f4a1331c95cf9ef3eddf98fb4e3abf638;hpb=59dbcc1245468218ec7e2372b2678351382a34f0;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index 4fbf4f1f4..06c2a13b6 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -73,7 +73,7 @@ typedef std::deque ResultQueue; unsigned long count(const char * const str, char a) { unsigned long n = 0; - for (const char *p = reinterpret_cast(str); *p; ++p) + for (const char *p = str; *p; ++p) { if (*p == '?') ++n; @@ -101,7 +101,7 @@ class ModuleSQL : public Module ~ModuleSQL(); unsigned long NewID(); const char* OnRequest(Request* request); - void OnRehash(User* user, const std::string ¶meter); + void OnRehash(User* user); Version GetVersion(); }; @@ -682,8 +682,7 @@ ModuleSQL::ModuleSQL(InspIRCd* Me) : Module(Me), rehashing(false) if (!ServerInstance->Modules->PublishFeature("SQL", this)) { - /* Tell worker thread to exit NOW, - * Automatically joins */ + Dispatcher->join(); delete Dispatcher; ServerInstance->Modules->DoneWithInterface("SQLutils"); throw ModuleException("m_mysql: Unable to publish feature 'SQL'"); @@ -746,7 +745,7 @@ const char* ModuleSQL::OnRequest(Request* request) return NULL; } -void ModuleSQL::OnRehash(User* user, const std::string ¶meter) +void ModuleSQL::OnRehash(User* user) { Dispatcher->LockQueue(); rehashing = true; @@ -762,6 +761,8 @@ void DispatcherThread::Run() { LoadDatabases(Parent->Conf, Parent->PublicServerInstance, Parent); + SQLConnection* conn = NULL; + this->LockQueue(); while (!this->GetExitFlag()) { @@ -771,6 +772,7 @@ void DispatcherThread::Run() LoadDatabases(Parent->Conf, Parent->PublicServerInstance, Parent); } + conn = NULL; Parent->ConnMutex.Lock(); for (ConnMap::iterator i = Connections.begin(); i != Connections.end(); i++) { @@ -804,9 +806,10 @@ void DispatcherThread::Run() void DispatcherThread::OnNotify() { + SQLConnection* conn; while (1) { - SQLConnection* conn = NULL; + conn = NULL; Parent->ConnMutex.Lock(); for (ConnMap::iterator iter = Connections.begin(); iter != Connections.end(); iter++) {