]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/inspircd.cpp
Optimisation of optimisation :P ty w00tie
[user/henk/code/inspircd.git] / src / inspircd.cpp
index c52444debaf9222779b513298c758ca10cfc36f5..253c2246b88d264943e84a1765ca503184361c26 100644 (file)
@@ -616,7 +616,22 @@ void InspIRCd::DoOneIteration(bool process_module_sockets)
         if (((TIME % 5) == 0) && (!expire_run))
         {
                 expire_lines();
-                FOREACH_MOD(I_OnBackgroundTimer,OnBackgroundTimer(TIME));
+               if (process_module_sockets)
+               {
+                       /* Fix by brain - the addition of DoOneIteration means that this
+                        * can end up getting called recursively in the following pattern:
+                        *
+                        * m_spanningtree DoPingChecks
+                        * (server pings out and is squit)
+                        * (squit causes call to DoOneIteration)
+                        * DoOneIteration enters here
+                        * calls DoBackground timer
+                        * enters m_spanningtree DoPingChecks... see step 1.
+                        *
+                        * This should do the job and fix the bug.
+                        */
+                       FOREACH_MOD(I_OnBackgroundTimer,OnBackgroundTimer(TIME));
+               }
                 TickMissedTimers(TIME);
                 expire_run = true;
                 return;
@@ -633,7 +648,7 @@ void InspIRCd::DoOneIteration(bool process_module_sockets)
                         WriteOpers("*** \002EH?!\002 -- Time is flowing BACKWARDS in this dimension! Clock drifted backwards %d secs.",abs(OLDTIME-TIME));
                 DoBackgroundUserStuff(TIME);
         }
-               
+
         /* Process timeouts on module sockets each time around
          * the loop. There shouldnt be many module sockets, at
          * most, 20 or so, so this won't be much of a performance
@@ -675,7 +690,7 @@ void InspIRCd::DoOneIteration(bool process_module_sockets)
                         case X_ESTAB_MODULE:
 
                                if (!process_module_sockets)
-                                       return;
+                                       break;
 
                                 /* Process module-owned sockets.
                                  * Modules are encouraged to inherit their sockets from