]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Changed how background processing works, now once per second repeating until nothing...
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Mon, 12 Dec 2005 17:27:58 +0000 (17:27 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Mon, 12 Dec 2005 17:27:58 +0000 (17:27 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2348 e03df62e-2008-0410-955e-edbf42e46eb7

src/inspircd.cpp

index 95c9c085fcbfbede574555ca571c8ba8b663d632..a305f9b0b4ba99e93f3d93a923f0a63dc41ff4f5 100644 (file)
@@ -2427,7 +2427,7 @@ void ProcessUser(userrec* cu)
         }
 }
 
-void DoBackgroundUserStuff(time_t TIME)
+bool DoBackgroundUserStuff(time_t TIME)
 {
        unsigned int numsockets = module_sockets.size();
        for (std::vector<InspSocket*>::iterator a = module_sockets.begin(); a < module_sockets.end(); a++)
@@ -2450,7 +2450,7 @@ void DoBackgroundUserStuff(time_t TIME)
                 if (count2->second)
                         curr = count2->second;
                 if ((long)curr == -1)
-                        return;
+                        return true;
 
                 if ((curr) && (curr->fd != 0))
                 {
@@ -2463,7 +2463,7 @@ void DoBackgroundUserStuff(time_t TIME)
                                 {
                                         log(DEBUG,"InspIRCd: write error: %s",curr->GetWriteError().c_str());
                                         kill_link(curr,curr->GetWriteError().c_str());
-                                        return;
+                                        return false;
                                 }
                                 // registration timeout -- didnt send USER/NICK/HOST in the time specified in
                                 // their connection class.
@@ -2471,7 +2471,7 @@ void DoBackgroundUserStuff(time_t TIME)
                                 {
                                         log(DEBUG,"InspIRCd: registration timeout: %s",curr->nick);
                                         kill_link(curr,"Registration timeout");
-                                        return;
+                                        return false;
                                 }
                                 if ((TIME > curr->signon) && (curr->registered == 3) && (AllModulesReportReady(curr)))
                                 {
@@ -2480,14 +2480,14 @@ void DoBackgroundUserStuff(time_t TIME)
                                         statsDnsBad++;
                                         FullConnectUser(curr);
                                         if (fd_ref_table[currfd] != curr) // something changed, bail pronto
-                                               return;
+                                               return false;
                                  }
                                  if ((curr->dns_done) && (curr->registered == 3) && (AllModulesReportReady(curr)))
                                  {
                                        log(DEBUG,"dns done, registered=3, and modules ready, OK");
                                        FullConnectUser(curr);
                                        if (fd_ref_table[currfd] != curr) // something changed, bail pronto
-                                                return;
+                                                return false;
                                  }
                                  if ((TIME > curr->nping) && (isnick(curr->nick)) && (curr->registered == 7))
                                  {
@@ -2495,16 +2495,17 @@ void DoBackgroundUserStuff(time_t TIME)
                                        {
                                               log(DEBUG,"InspIRCd: ping timeout: %s",curr->nick);
                                                kill_link(curr,"Ping timeout");
-                                               return;
+                                               return false;
                                        }
                                        Write(curr->fd,"PING :%s",ServerName);
                                        log(DEBUG,"InspIRCd: pinging: %s",curr->nick);
                                        curr->lastping = 0;
                                        curr->nping = TIME+curr->pingmax;       // was hard coded to 120
-                                 }
-                         }
-                 }
-         }
+                               }
+                       }
+               }
+       }
+       return true;
 }
 
 void OpenLog(char** argv, int argc)
@@ -2687,7 +2688,8 @@ int InspIRCd(char** argv, int argc)
                if ((TIME % 8) == 1)
                        expire_run = false;
                
-               DoBackgroundUserStuff(TIME);
+               if (TIME != OLDTIME)
+                       while (DoBackgroundUserStuff(TIME));
 
                SE->Wait(activefds);