From 972a60680c419e3d78cb02c320718463cebaa667 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Thu, 5 Apr 2018 15:49:05 +0200 Subject: [PATCH] rec: Clean up the cache entry ctor in the recursor packet cache --- pdns/recpacketcache.cc | 8 +------- pdns/recpacketcache.hh | 7 +++++-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/pdns/recpacketcache.cc b/pdns/recpacketcache.cc index 354c3d47a9..fc27b26d43 100644 --- a/pdns/recpacketcache.cc +++ b/pdns/recpacketcache.cc @@ -7,11 +7,7 @@ #include "recpacketcache.hh" #include "cachecleaner.hh" #include "dns.hh" -#include "dnsparser.hh" #include "namespaces.hh" -#include "lock.hh" -#include "dnswriter.hh" -#include "ednsoptions.hh" RecursorPacketCache::RecursorPacketCache() { @@ -171,9 +167,7 @@ void RecursorPacketCache::insertResponsePacket(unsigned int tag, uint32_t qhash, } if(iter == range.second) { // nothing to refresh - struct Entry e; - e.d_packet = responsePacket; - e.d_name = qname; + struct Entry e(qname, responsePacket); e.d_qhash = qhash; e.d_type = qtype; e.d_class = qclass; diff --git a/pdns/recpacketcache.hh b/pdns/recpacketcache.hh index 40c94e94f5..2ceda67a06 100644 --- a/pdns/recpacketcache.hh +++ b/pdns/recpacketcache.hh @@ -22,7 +22,6 @@ #ifndef PDNS_RECPACKETCACHE_HH #define PDNS_RECPACKETCACHE_HH #include -#include #include #include "dns.hh" #include "namespaces.hh" @@ -72,6 +71,10 @@ private: struct NameTag {}; struct Entry { + Entry(const DNSName& qname, const std::string& packet): d_name(qname), d_packet(packet) + { + } + mutable time_t d_ttd; mutable time_t d_creation; // so we can 'age' our packets DNSName d_name; @@ -84,7 +87,7 @@ private: uint32_t d_qhash; uint32_t d_tag; inline bool operator<(const struct Entry& rhs) const; - + time_t getTTD() const { return d_ttd; -- 2.47.2