summaryrefslogtreecommitdiff
path: root/src/userprocess.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-28 19:57:26 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-28 19:57:26 +0000
commit3b6b04b1ee6ce0b9b5274def704170e6181236ec (patch)
tree2ef95d38433caca09889e5ea406ef1519da24041 /src/userprocess.cpp
parent025dbe3aa585e4002946d2bb80cba88fa15337b3 (diff)
Changes to the way clients are exited during mainloop - MAY BE UNSTABLE USE WITH CAUTION
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2680 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/userprocess.cpp')
-rw-r--r--src/userprocess.cpp30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/userprocess.cpp b/src/userprocess.cpp
index 6fc62cbdb..2398ff8fe 100644
--- a/src/userprocess.cpp
+++ b/src/userprocess.cpp
@@ -58,6 +58,7 @@ using namespace std;
#include "socketengine.h"
#include "typedefs.h"
#include "command_parse.h"
+#include "cull_list.h"
extern int MODCOUNT;
extern struct sockaddr_in client,server;
@@ -240,6 +241,8 @@ void ProcessUser(userrec* cu)
}
+CullList* GlobalGoners;
+
/**
* This function is called once a second from the mainloop.
* It is intended to do background checking on all the user structs, e.g.
@@ -268,8 +271,7 @@ bool DoBackgroundUserStuff(time_t TIME)
}
if (module_sockets.size() != numsockets) break;
}
- /* TODO: We need a seperate hash containing only local users for this
- */
+ GlobalGoners = new CullList();
for (std::vector<userrec*>::iterator count2 = local_users.begin(); count2 != local_users.end(); count2++)
{
/* Sanity checks for corrupted iterators (yes, really) */
@@ -289,40 +291,38 @@ bool DoBackgroundUserStuff(time_t TIME)
if (curr->GetWriteError() != "")
{
log(DEBUG,"InspIRCd: write error: %s",curr->GetWriteError().c_str());
- kill_link(curr,curr->GetWriteError().c_str());
- return true;
+ GlobalGoners->AddItem(curr,curr->GetWriteError());
+ continue;
}
// registration timeout -- didnt send USER/NICK/HOST in the time specified in
// their connection class.
if (((unsigned)TIME > (unsigned)curr->timeout) && (curr->registered != 7))
{
log(DEBUG,"InspIRCd: registration timeout: %s",curr->nick);
- kill_link(curr,"Registration timeout");
- return true;
+ GlobalGoners->AddItem(curr,"Registration timeout");
+ continue;
}
if ((TIME > curr->signon) && (curr->registered == 3) && (AllModulesReportReady(curr)))
{
log(DEBUG,"signon exceed, registered=3, and modules ready, OK: %d %d",TIME,curr->signon);
curr->dns_done = true;
ServerInstance->stats->statsDnsBad++;
- FullConnectUser(curr);
- if (fd_ref_table[currfd] != curr) // something changed, bail pronto
- return true;
+ FullConnectUser(curr,GlobalGoners);
+ continue;
}
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 true;
+ FullConnectUser(curr,GlobalGoners);
+ continue;
}
if ((TIME > curr->nping) && (isnick(curr->nick)) && (curr->registered == 7))
{
if ((!curr->lastping) && (curr->registered == 7))
{
log(DEBUG,"InspIRCd: ping timeout: %s",curr->nick);
- kill_link(curr,"Ping timeout");
- return true;
+ GlobalGoners->AddItem(curr,"Ping timeout");
+ continue;
}
Write(curr->fd,"PING :%s",Config->ServerName);
log(DEBUG,"InspIRCd: pinging: %s",curr->nick);
@@ -332,6 +332,8 @@ bool DoBackgroundUserStuff(time_t TIME)
}
}
}
+ GlobalGoners->Apply();
+ delete GlobalGoners;
return false;
}