summaryrefslogtreecommitdiff
path: root/src/server.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-11-22 16:54:32 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-11-22 16:54:32 +0000
commit9bddcf91ac79f34f8721bbf161f90cc4cc9dbe8c (patch)
tree7fb6284977dbd4f94e5e34b08f0a7311ed854075 /src/server.cpp
parentf7844096dcbe912557b46b0a52b35cf7cf6fc07e (diff)
Thread safety fixes to avoid crashes on rehash, dont reopen logs within the rehash thread. Put this in the safe part of the rehash operation, after the thread exits. Put a mutex around the part where the thread exits, just in case somehow there are two rehash threads exiting at the same time due to user
muppetry. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10811 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/server.cpp')
-rw-r--r--src/server.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/server.cpp b/src/server.cpp
index c3efc7e6b..44f2ce78f 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -48,6 +48,7 @@ void InspIRCd::Exit(int status)
void RehashHandler::Call(const std::string &reason)
{
+ Server->RehashFinishMutex->Lock();
Server->SNO->WriteToSnoMask('A', "Rehashing config file %s %s",ServerConfig::CleanFilename(Server->ConfigFileName), reason.c_str());
Server->RehashUsersAndChans();
FOREACH_MOD_I(Server, I_OnGarbageCollect, OnGarbageCollect());
@@ -59,6 +60,7 @@ void RehashHandler::Call(const std::string &reason)
Server->ConfigThread = new ConfigReaderThread(Server, false, "");
Server->Threads->Create(Server->ConfigThread);
}
+ Server->RehashFinishMutex->Unlock();
}
void InspIRCd::RehashServer()