From 9bddcf91ac79f34f8721bbf161f90cc4cc9dbe8c Mon Sep 17 00:00:00 2001 From: brain Date: Sat, 22 Nov 2008 16:54:32 +0000 Subject: 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 --- src/server.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/server.cpp') 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() -- cgit v1.2.3