summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cmd_nick.cpp5
-rw-r--r--src/cmd_user.cpp5
-rw-r--r--src/userprocess.cpp30
-rw-r--r--src/users.cpp14
4 files changed, 31 insertions, 23 deletions
diff --git a/src/cmd_nick.cpp b/src/cmd_nick.cpp
index dd3850342..fe600dc30 100644
--- a/src/cmd_nick.cpp
+++ b/src/cmd_nick.cpp
@@ -49,6 +49,7 @@ using namespace std;
#include "typedefs.h"
#include "command_parse.h"
#include "cmd_nick.h"
+#include "cull_list.h"
extern ServerConfig* Config;
extern InspIRCd* ServerInstance;
@@ -63,6 +64,8 @@ extern std::vector<userrec*> all_opers;
extern std::vector<userrec*> local_users;
extern userrec* fd_ref_table[65536];
+extern CullList* GlobalGoners;
+
void cmd_nick::Handle (char **parameters, int pcnt, userrec *user)
{
char oldnick[NICKMAX];
@@ -191,7 +194,7 @@ void cmd_nick::Handle (char **parameters, int pcnt, userrec *user)
{
/* user is registered now, bit 0 = USER command, bit 1 = sent a NICK command */
FOREACH_MOD(I_OnUserRegister,OnUserRegister(user));
- ConnectUser(user);
+ ConnectUser(user,GlobalGoners);
}
if (user->registered == 7)
{
diff --git a/src/cmd_user.cpp b/src/cmd_user.cpp
index 8c2b4fe64..7aa64b092 100644
--- a/src/cmd_user.cpp
+++ b/src/cmd_user.cpp
@@ -48,6 +48,7 @@ using namespace std;
#include "typedefs.h"
#include "command_parse.h"
#include "cmd_user.h"
+#include "cull_list.h"
extern ServerConfig* Config;
extern InspIRCd* ServerInstance;
@@ -62,6 +63,8 @@ extern std::vector<userrec*> all_opers;
extern std::vector<userrec*> local_users;
extern userrec* fd_ref_table[65536];
+extern CullList* GlobalGoners;
+
void cmd_user::Handle (char **parameters, int pcnt, userrec *user)
{
log(DEBUG,"Handling USER from cmd_user class!");
@@ -92,7 +95,7 @@ void cmd_user::Handle (char **parameters, int pcnt, userrec *user)
{
/* user is registered now, bit 0 = USER command, bit 1 = sent a NICK command */
FOREACH_MOD(I_OnUserRegister,OnUserRegister(user));
- ConnectUser(user);
+ ConnectUser(user,GlobalGoners);
}
}
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;
}
diff --git a/src/users.cpp b/src/users.cpp
index a9f927f3f..bde0f99fd 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -633,7 +633,7 @@ void AddClient(int socket, char* host, int port, bool iscached, char* ip)
ServerInstance->SE->AddFd(socket,true,X_ESTAB_CLIENT);
}
-void FullConnectUser(userrec* user)
+void FullConnectUser(userrec* user, CullList* Goners)
{
ServerInstance->stats->statsConnects++;
user->idle_lastmsg = TIME;
@@ -641,12 +641,12 @@ void FullConnectUser(userrec* user)
if ((strcmp(Passwd(user),"")) && (!user->haspassed))
{
- kill_link(user,"Invalid password");
+ Goners->AddItem(user,"Invalid password");
return;
}
if (IsDenied(user))
{
- kill_link(user,"Unauthorised connection");
+ Goners->AddItem(user,"Unauthorised connection");
return;
}
@@ -660,7 +660,7 @@ void FullConnectUser(userrec* user)
{
char reason[MAXBUF];
snprintf(reason,MAXBUF,"G-Lined: %s",r);
- kill_link_silent(user,reason);
+ Goners->AddItem(user,reason);
return;
}
r = matches_kline(user->host);
@@ -668,7 +668,7 @@ void FullConnectUser(userrec* user)
{
char reason[MAXBUF];
snprintf(reason,MAXBUF,"K-Lined: %s",r);
- kill_link_silent(user,reason);
+ Goners->AddItem(user,reason);
return;
}
}
@@ -717,12 +717,12 @@ void FullConnectUser(userrec* user)
/* shows the message of the day, and any other on-logon stuff */
-void ConnectUser(userrec *user)
+void ConnectUser(userrec *user, CullList* Goners)
{
// dns is already done, things are fast. no need to wait for dns to complete just pass them straight on
if ((user->dns_done) && (user->registered >= 3) && (AllModulesReportReady(user)))
{
- FullConnectUser(user);
+ FullConnectUser(user, Goners);
}
}