]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Change allocation of InspIRCd::BanCache to be physically part of the object containing it
authorAttila Molnar <attilamolnar@hush.com>
Fri, 13 Jun 2014 13:27:40 +0000 (15:27 +0200)
committerAttila Molnar <attilamolnar@hush.com>
Fri, 13 Jun 2014 13:27:40 +0000 (15:27 +0200)
include/inspircd.h
src/inspircd.cpp
src/usermanager.cpp
src/users.cpp
src/xline.cpp

index 60c8f761db0030165a6ac205266e06ad2215c83f..e575cd8b021726ffdffdebb025013ce52d467fb0 100644 (file)
@@ -365,7 +365,7 @@ class CoreExport InspIRCd
        /** BanCacheManager is used to speed up checking of restrictions on connection
         * to the IRCd.
         */
-       BanCacheManager *BanCache;
+       BanCacheManager BanCache;
 
        /** Stats class, holds miscellaneous stats counters
         */
index c878138fe4154475f4cfaf0591439a12aa486cce..898b4f455e1d03659cb364ec73e05efd3fdda3aa 100644 (file)
@@ -133,7 +133,6 @@ void InspIRCd::Cleanup()
        DeleteZero(this->XLines);
        DeleteZero(this->Parser);
        DeleteZero(this->Modules);
-       DeleteZero(this->BanCache);
        DeleteZero(this->SNO);
        DeleteZero(this->Config);
        DeleteZero(this->PI);
@@ -262,7 +261,6 @@ InspIRCd::InspIRCd(int argc, char** argv) :
        this->Users = 0;
        this->Config = 0;
        this->SNO = 0;
-       this->BanCache = 0;
        this->Modules = 0;
        this->Parser = 0;
        this->XLines = 0;
@@ -286,7 +284,6 @@ InspIRCd::InspIRCd(int argc, char** argv) :
 
        this->Config = new ServerConfig;
        this->SNO = new SnomaskManager;
-       this->BanCache = new BanCacheManager;
        this->Modules = new ModuleManager();
        dynamic_reference_base::reset_all();
        this->Parser = new CommandParser;
index 665149e4872d88bc4cbaed66b38835389fa14ba1..37f64b9d2904d6d3b701f12c67bca2f721316a1a 100644 (file)
@@ -104,7 +104,8 @@ void UserManager::AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs
         */
        New->exempt = (ServerInstance->XLines->MatchesLine("E",New) != NULL);
 
-       if (BanCacheHit *b = ServerInstance->BanCache->GetHit(New->GetIPString()))
+       BanCacheHit* const b = ServerInstance->BanCache.GetHit(New->GetIPString());
+       if (b)
        {
                if (!b->Type.empty() && !New->exempt)
                {
index 7fba57faa8b59b5825ea6dc40398c4633f1dedd3..9a6c573f3bb67993881926f563b57966b8ff41e1 100644 (file)
@@ -599,7 +599,7 @@ void LocalUser::FullConnect()
        ServerInstance->SNO->WriteToSnoMask('c',"Client connecting on port %d (class %s): %s (%s) [%s]",
                this->GetServerPort(), this->MyClass->name.c_str(), GetFullRealHost().c_str(), this->GetIPString().c_str(), this->fullname.c_str());
        ServerInstance->Logs->Log("BANCACHE", LOG_DEBUG, "BanCache: Adding NEGATIVE hit for " + this->GetIPString());
-       ServerInstance->BanCache->AddHit(this->GetIPString(), "", "");
+       ServerInstance->BanCache.AddHit(this->GetIPString(), "", "");
        // reset the flood penalty (which could have been raised due to things like auto +x)
        CommandFloodPenalty = 0;
 }
index 9b90c56f7979b830982e8c28df15af95138ce4be..c48db51b1dde81ef2f72afd7f69c0dbba67f9aa7 100644 (file)
@@ -275,7 +275,7 @@ bool XLineManager::AddLine(XLine* line, User* user)
        if (!xlf)
                return false;
 
-       ServerInstance->BanCache->RemoveEntries(line->type, false); // XXX perhaps remove ELines here?
+       ServerInstance->BanCache.RemoveEntries(line->type, false); // XXX perhaps remove ELines here?
 
        if (xlf->AutoApplyToUserList(line))
                pending_lines.push_back(line);
@@ -305,7 +305,7 @@ bool XLineManager::DelLine(const char* hostmask, const std::string &type, User*
        if (simulate)
                return true;
 
-       ServerInstance->BanCache->RemoveEntries(y->second->type, true);
+       ServerInstance->BanCache.RemoveEntries(y->second->type, true);
 
        FOREACH_MOD(OnDelLine, (user, y->second));
 
@@ -544,7 +544,7 @@ void XLine::DefaultApply(User* u, const std::string &line, bool bancache)
        if (bancache)
        {
                ServerInstance->Logs->Log("BANCACHE", LOG_DEBUG, "BanCache: Adding positive hit (" + line + ") for " + u->GetIPString());
-               ServerInstance->BanCache->AddHit(u->GetIPString(), this->type, banReason, this->duration);
+               ServerInstance->BanCache.AddHit(u->GetIPString(), this->type, banReason, this->duration);
        }
 }