summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/commands.cpp6
-rw-r--r--src/inspircd.cpp1
-rw-r--r--src/userprocess.cpp7
-rw-r--r--src/users.cpp16
4 files changed, 27 insertions, 3 deletions
diff --git a/src/commands.cpp b/src/commands.cpp
index 1a5eb81d0..258fb635c 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -83,6 +83,7 @@ extern whowas_hash whowas;
extern command_table cmdlist;
extern std::vector<userrec*> all_opers;
+extern std::vector<userrec*> local_users;
// This table references users by file descriptor.
// its an array to make it VERY fast, as all lookups are referenced
@@ -912,6 +913,11 @@ void handle_quit(char **parameters, int pcnt, userrec *user)
if (user->fd > -1)
{
SE->DelFd(user->fd);
+ if (find(local_users.begin(),local_users.end(),user) != local_users.end())
+ {
+ log(DEBUG,"Delete local user");
+ local_users.erase(find(local_users.begin(),local_users.end(),user));
+ }
user->CloseSocket();
}
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 8f2bd0de1..83f5948fb 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -69,6 +69,7 @@ int WHOWAS_MAX = 100; // default 100 people maximum in the WHOWAS list
extern std::vector<Module*> modules;
extern std::vector<ircd_module*> factory;
std::vector<InspSocket*> module_sockets;
+std::vector<userrec*> local_users;
extern int MODCOUNT;
int openSockfd[MAXSOCKS];
diff --git a/src/userprocess.cpp b/src/userprocess.cpp
index 2eb7b7043..b5a5b6683 100644
--- a/src/userprocess.cpp
+++ b/src/userprocess.cpp
@@ -66,6 +66,7 @@ extern std::vector<ircd_module*> factory;
extern std::vector<InspSocket*> module_sockets;
extern time_t TIME;
extern time_t OLDTIME;
+extern std::vector<userrec*> local_users;
extern InspIRCd* ServerInstance;
extern SocketEngine* SE;
@@ -264,12 +265,12 @@ bool DoBackgroundUserStuff(time_t TIME)
}
/* TODO: We need a seperate hash containing only local users for this
*/
- for (user_hash::iterator count2 = clientlist.begin(); count2 != clientlist.end(); count2++)
+ for (std::vector<userrec*>::iterator count2 = local_users.begin(); count2 != local_users.end(); count2++)
{
/* Sanity checks for corrupted iterators (yes, really) */
userrec* curr = NULL;
- if (count2->second)
- curr = count2->second;
+ if (*count2)
+ curr = (userrec*)(*count2);
if ((long)curr == -1)
return false;
diff --git a/src/users.cpp b/src/users.cpp
index 57091aea1..f2a43238a 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -51,6 +51,7 @@ extern serverstats* stats;
extern ServerConfig *Config;
extern user_hash clientlist;
extern whowas_hash whowas;
+std::vector<userrec*> local_users;
std::vector<userrec*> all_opers;
@@ -390,7 +391,14 @@ void kill_link(userrec *user,const char* r)
{
log(DEBUG,"deleting user hash value %lu",(unsigned long)user);
if (user->fd > -1)
+ {
fd_ref_table[user->fd] = NULL;
+ if (find(local_users.begin(),local_users.end(),user) != local_users.end())
+ {
+ local_users.erase(find(local_users.begin(),local_users.end(),user));
+ log(DEBUG,"Delete local user");
+ }
+ }
clientlist.erase(iter);
}
delete user;
@@ -437,7 +445,14 @@ void kill_link_silent(userrec *user,const char* r)
{
log(DEBUG,"deleting user hash value %lu",(unsigned long)user);
if (user->fd > -1)
+ {
fd_ref_table[user->fd] = NULL;
+ if (find(local_users.begin(),local_users.end(),user) != local_users.end())
+ {
+ log(DEBUG,"Delete local user");
+ local_users.erase(find(local_users.begin(),local_users.end(),user));
+ }
+ }
clientlist.erase(iter);
}
delete user;
@@ -618,6 +633,7 @@ void AddClient(int socket, char* host, int port, bool iscached, char* ip)
}
}
fd_ref_table[socket] = clientlist[tempnick];
+ local_users.push_back(clientlist[tempnick]);
SE->AddFd(socket,true,X_ESTAB_CLIENT);
}