From 42105f07dd1ac0e04e28077754b6245a80d55597 Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 15 Jul 2007 13:18:28 +0000 Subject: Fix for bug #349: NOTE there is important caveat about this in the example config, MAKE SURE TO READ IT. When you connect a cgi:irc client two different connect classes are checked at two different times (first the one that the website they are cgi'ing from, then later one for the user's real ip). READ THIS AND UNDERSTAND IT! git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7440 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/users.cpp | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) (limited to 'src/users.cpp') diff --git a/src/users.cpp b/src/users.cpp index d83788566..7da7d6b09 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -344,6 +344,29 @@ userrec::userrec(InspIRCd* Instance) : ServerInstance(Instance) operquit = cached_fullhost = cached_hostip = cached_makehost = cached_fullrealhost = NULL; } +void userrec::RemoveCloneCounts() +{ + clonemap::iterator x = ServerInstance->local_clones.find(this->GetIPString()); + if (x != ServerInstance->local_clones.end()) + { + x->second--; + if (!x->second) + { + ServerInstance->local_clones.erase(x); + } + } + + clonemap::iterator y = ServerInstance->global_clones.find(this->GetIPString()); + if (y != ServerInstance->global_clones.end()) + { + y->second--; + if (!y->second) + { + ServerInstance->global_clones.erase(y); + } + } +} + userrec::~userrec() { this->InvalidateCache(); @@ -352,25 +375,7 @@ userrec::~userrec() free(operquit); if (ip) { - clonemap::iterator x = ServerInstance->local_clones.find(this->GetIPString()); - if (x != ServerInstance->local_clones.end()) - { - x->second--; - if (!x->second) - { - ServerInstance->local_clones.erase(x); - } - } - - clonemap::iterator y = ServerInstance->global_clones.find(this->GetIPString()); - if (y != ServerInstance->global_clones.end()) - { - y->second--; - if (!y->second) - { - ServerInstance->global_clones.erase(y); - } - } + this->RemoveCloneCounts(); if (this->GetProtocolFamily() == AF_INET) { -- cgit v1.3.1-10-gc9f91