mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 11:09:04 -04:00
BanCache: Do one hash lookup in BanCacheManager::AddHit()
This commit is contained in:
parent
c5d1a7843e
commit
239a3bb0f8
@ -25,14 +25,11 @@
|
|||||||
|
|
||||||
BanCacheHit *BanCacheManager::AddHit(const std::string &ip, const std::string &type, const std::string &reason, time_t seconds)
|
BanCacheHit *BanCacheManager::AddHit(const std::string &ip, const std::string &type, const std::string &reason, time_t seconds)
|
||||||
{
|
{
|
||||||
BanCacheHit *b;
|
BanCacheHit*& b = (*BanHash)[ip];
|
||||||
|
if (b != NULL) // can't have two cache entries on the same IP, sorry..
|
||||||
if (this->BanHash->find(ip) != this->BanHash->end()) // can't have two cache entries on the same IP, sorry..
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
b = new BanCacheHit(ip, type, reason, (seconds ? seconds : 86400));
|
b = new BanCacheHit(type, reason, (seconds ? seconds : 86400));
|
||||||
|
|
||||||
this->BanHash->insert(std::make_pair(ip, b));
|
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user