From bb962f92ace6eb23c66c5fccee01f825c22363c3 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Thu, 16 May 2013 20:51:12 +0200 Subject: Workaround for std::list::size() having linear complexity on some implementations --- include/usermanager.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include/usermanager.h') diff --git a/include/usermanager.h b/include/usermanager.h index 3d7fe88fb..743db508a 100644 --- a/include/usermanager.h +++ b/include/usermanager.h @@ -63,7 +63,11 @@ class CoreExport UserManager /** Number of unregistered users online right now. * (Unregistered means before USER/NICK/dns) */ - int unregistered_count; + unsigned int unregistered_count; + + /** Number of elements in local_users + */ + unsigned int local_count; /** Map of global ip addresses for clone counting * XXX - this should be private, but m_clones depends on it currently. -- cgit v1.2.3 From 67822c67e91e70917ddbdec0bd8453c7170ee06d Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Sat, 18 May 2013 16:03:17 +0200 Subject: Initialize local_count --- include/usermanager.h | 2 ++ src/inspircd.cpp | 2 -- src/usermanager.cpp | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) (limited to 'include/usermanager.h') diff --git a/include/usermanager.h b/include/usermanager.h index 743db508a..ac8ae1cb3 100644 --- a/include/usermanager.h +++ b/include/usermanager.h @@ -32,6 +32,8 @@ class CoreExport UserManager */ clonemap local_clones; public: + UserManager(); + ~UserManager() { for (user_hash::iterator i = clientlist->begin();i != clientlist->end();i++) diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 344e2a473..4def50c87 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -375,8 +375,6 @@ InspIRCd::InspIRCd(int argc, char** argv) : // Create base manager classes early, so nothing breaks this->Users = new UserManager; - this->Users->unregistered_count = 0; - this->Users->clientlist = new user_hash(); this->Users->uuidlist = new user_hash(); this->chanlist = new chan_hash(); diff --git a/src/usermanager.cpp b/src/usermanager.cpp index 670add777..076277a33 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -24,6 +24,11 @@ #include "xline.h" #include "bancache.h" +UserManager::UserManager() + : unregistered_count(0), local_count(0) +{ +} + /* add a client connection to the sockets list */ void UserManager::AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server) { -- cgit v1.2.3