+ if (RemoveIfExpired(i))
+ continue; // updates the iterator if expired
+
+ BanCacheHit* b = i->second;
+ bool remove = false;
+
+ if (positive)
+ {
+ // when removing positive hits, remove only if the type matches
+ remove = b->IsPositive() && (b->Type == type);
+ }
+ else
+ {
+ // when removing negative hits, remove all of them
+ remove = !b->IsPositive();
+ }
+
+ if (remove)
+ {
+ /* we need to remove this one. */
+ ServerInstance->Logs->Log("BANCACHE", LOG_DEBUG, "BanCacheManager::RemoveEntries(): Removing a hit on " + i->first);
+ delete b;
+ i = BanHash->erase(i);
+ }
+ else
+ ++i;