X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fdns.cpp;h=3d3bc947fee2cfbee4f045e04b56b5eeb0730687;hb=25c1319e0d16f4cea707a3b7968b70530a5a333f;hp=1755c7dac85f1c9b474fb2cd4291269e91062a07;hpb=2fe72dc9a8533e880f53d9f37bd1684f41052035;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/dns.cpp b/src/dns.cpp index 1755c7dac..3d3bc947f 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -162,6 +162,8 @@ class RequestTimeout : public Timer CachedQuery::CachedQuery(const std::string &res, QueryType qt, unsigned int ttl) : data(res), type(qt) { + if (ttl > 5*60) + ttl = 5*60; expires = ServerInstance->Time() + ttl; } @@ -1058,7 +1060,11 @@ void DNS::HandleEvent(EventType, int) ServerInstance->stats->statsDnsGood++; if (!this->GetCache(res.original.c_str())) + { + if (cache->size() >= MAX_CACHE_SIZE) + cache->clear(); this->cache->insert(std::make_pair(res.original.c_str(), CachedQuery(res.result, res.type, res.ttl))); + } Classes[res.id]->OnLookupComplete(res.result, res.ttl, false); delete Classes[res.id];