From f1f8173bb5ca5f5ce01ad92d0ccd309f232fc138 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Fri, 24 Jan 2014 13:08:13 +0100 Subject: Convert LocalUserList to an intrusively linked list --- include/typedefs.h | 2 +- include/usermanager.h | 6 +----- include/users.h | 6 +----- 3 files changed, 3 insertions(+), 11 deletions(-) (limited to 'include') diff --git a/include/typedefs.h b/include/typedefs.h index 050707e73..067768db4 100644 --- a/include/typedefs.h +++ b/include/typedefs.h @@ -57,7 +57,7 @@ typedef TR1NS::unordered_map LocalUserList; +typedef intrusive_list LocalUserList; /** A list of failed port bindings, used for informational purposes on startup */ typedef std::vector > FailedPortList; diff --git a/include/usermanager.h b/include/usermanager.h index a807cd447..e287d74d0 100644 --- a/include/usermanager.h +++ b/include/usermanager.h @@ -63,10 +63,6 @@ class CoreExport UserManager */ 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. */ @@ -159,7 +155,7 @@ class CoreExport UserManager /** Return a count of local registered users * @return The number of registered local users */ - unsigned int LocalUserCount() const { return (this->local_count - this->UnregisteredUserCount()); } + unsigned int LocalUserCount() const { return (this->local_users.size() - this->UnregisteredUserCount()); } /** Send a server notice to all local users * @param text The text format string to send diff --git a/include/users.h b/include/users.h index f8bfb5a6e..db2d53878 100644 --- a/include/users.h +++ b/include/users.h @@ -655,7 +655,7 @@ class CoreExport UserIOHandler : public StreamSocket typedef unsigned int already_sent_t; -class CoreExport LocalUser : public User, public InviteBase +class CoreExport LocalUser : public User, public InviteBase, public intrusive_list_node { public: LocalUser(int fd, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server); @@ -663,10 +663,6 @@ class CoreExport LocalUser : public User, public InviteBase UserIOHandler eh; - /** Position in UserManager::local_users - */ - LocalUserList::iterator localuseriter; - /** Stats counter for bytes inbound */ unsigned int bytes_in; -- cgit v1.2.3