]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Rebuild clone counts on rehash
authorAdam <Adam@anope.org>
Tue, 3 Mar 2015 20:45:22 +0000 (15:45 -0500)
committerAdam <Adam@anope.org>
Sat, 21 Mar 2015 16:53:21 +0000 (12:53 -0400)
include/usermanager.h
src/configreader.cpp
src/usermanager.cpp

index ac8ae1cb3ef1b82eb12a64756dfd06da1e737559..2a9d6b47b2b9ca54c893ba75a07bbe296a74f9e9 100644 (file)
@@ -112,6 +112,10 @@ class CoreExport UserManager
         */
        void RemoveCloneCounts(User *user);
 
+       /** Rebuild clone counts
+        */
+       void RehashCloneCounts();
+
        /** Return the number of global clones of this user
         * @param user The user to get a count for
         * @return The global clone count of this user
index b3caf8c7501146e7afdac5d80d0ed42c6f877234..bcee938d55208e1aefc3dcc5d0db93cf81820175 100644 (file)
@@ -963,6 +963,7 @@ void ConfigReaderThread::Finish()
                 * XXX: The order of these is IMPORTANT, do not reorder them without testing
                 * thoroughly!!!
                 */
+               ServerInstance->Users->RehashCloneCounts();
                ServerInstance->XLines->CheckELines();
                ServerInstance->XLines->ApplyLines();
                ServerInstance->Res->Rehash();
index 1918b5c4c1cc43a985c13fc3880c376297f41045..76446c5b57fb07371adaa9b6730e6f335d7e0805 100644 (file)
@@ -287,6 +287,22 @@ void UserManager::RemoveCloneCounts(User *user)
        }
 }
 
+void UserManager::RehashCloneCounts()
+{
+       local_clones.clear();
+       global_clones.clear();
+
+       const user_hash& hash = *ServerInstance->Users->clientlist;
+       for (user_hash::const_iterator i = hash.begin(); i != hash.end(); ++i)
+       {
+               User* u = i->second;
+
+               if (IS_LOCAL(u))
+                       AddLocalClone(u);
+               AddGlobalClone(u);
+       }
+}
+
 unsigned long UserManager::GlobalCloneCount(User *user)
 {
        clonemap::iterator x = global_clones.find(user->GetCIDRMask());