summaryrefslogtreecommitdiff
path: root/src/inspircd.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-12 17:27:58 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-12 17:27:58 +0000
commit41f47a3543ae885d32695284383b4f524f5d3e6f (patch)
treea6f11aca55d57e7ddafcd979ec55e5b87744f50f /src/inspircd.cpp
parentf85091129c40facd69a72bbc00084fe5c3c0c02f (diff)
Changed how background processing works, now once per second repeating until nothing left to do
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2348 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/inspircd.cpp')
-rw-r--r--src/inspircd.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 95c9c085f..a305f9b0b 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -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);