summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/bancache.h2
-rw-r--r--src/bancache.cpp22
2 files changed, 24 insertions, 0 deletions
diff --git a/include/bancache.h b/include/bancache.h
index 19fc0d952..2ae740ece 100644
--- a/include/bancache.h
+++ b/include/bancache.h
@@ -62,6 +62,8 @@ class CoreExport BanCacheManager : public classbase
this->ServerInstance = Instance;
this->BanHash = new BanCacheHash();
}
+
+ void RehashCache();
};
#endif
diff --git a/src/bancache.cpp b/src/bancache.cpp
index a831b1219..bfa1bde11 100644
--- a/src/bancache.cpp
+++ b/src/bancache.cpp
@@ -63,4 +63,26 @@ bool BanCacheManager::RemoveHit(BanCacheHit *b)
return true;
}
+void BanCacheManager::RehashCache()
+{
+ BanCacheHash* NewHash = new BanCacheHash();
+
+ BanCacheHash::iterator safei;
+ for (BanCacheHash::iterator n = BanHash->begin(); n != BanHash->end(); )
+ {
+ safei = n;
+ safei++;
+
+ /* Safe to delete items here through iterator 'n' */
+
+ /* Actually inserts a std::pair */
+ NewHash->insert(*n);
+ /* End of safe section */
+
+ n = safei;
+ }
+
+ delete BanHash;
+ BanHash = NewHash;
+}