Change allocation of InspIRCd::BanCache to be physically part of the object containing it

This commit is contained in:
Attila Molnar 2014-06-13 15:27:40 +02:00
parent caa0c27a5a
commit 467b276d9d
5 changed files with 7 additions and 9 deletions

View 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
*/

View 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;

View 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)
{

View 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;
}

View 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);
}
}