summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2020-01-17 16:13:32 +0000
committerSadie Powell <sadie@witchery.services>2020-01-17 16:13:32 +0000
commit1158a6767613ba14ebb5359b118e025736ad8acd (patch)
treedd0372bbaa5de7f90b0826de2b7c70066974f9ca /src
parent2e91d9b2e19a5dee8e5e0959bc9face260c22daf (diff)
Improve the DNS cache expiration log message.
Instead of constantly spamming the log file only show the message when an entry is actually expired and show how many entries were expired.
Diffstat (limited to 'src')
-rw-r--r--src/coremods/core_dns.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/coremods/core_dns.cpp b/src/coremods/core_dns.cpp
index 3412ec611..2e75a591f 100644
--- a/src/coremods/core_dns.cpp
+++ b/src/coremods/core_dns.cpp
@@ -682,16 +682,22 @@ class MyManager : public Manager, public Timer, public EventHandler
bool Tick(time_t now) CXX11_OVERRIDE
{
- ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "cache: purging DNS cache");
-
+ unsigned long expired = 0;
for (cache_map::iterator it = this->cache.begin(); it != this->cache.end(); )
{
const Query& query = it->second;
if (IsExpired(query, now))
+ {
+ expired++;
this->cache.erase(it++);
+ }
else
++it;
}
+
+ if (expired)
+ ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "cache: purged %lu expired DNS entries", expired);
+
return true;
}