]> granicus.if.org Git - pdns/commitdiff
rec: Clean up the cache entry ctor in the recursor packet cache
authorRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 5 Apr 2018 13:49:05 +0000 (15:49 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 9 Apr 2018 12:43:00 +0000 (14:43 +0200)
pdns/recpacketcache.cc
pdns/recpacketcache.hh

index 354c3d47a972f9f74a574b7888d809476a4cc661..fc27b26d43879a10cafeecc7b5b81d470c1717d1 100644 (file)
@@ -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;
index 40c94e94f59fd08c6436ea1d9557bc48fa877c40..2ceda67a06b7f25d6906d577f575661f67ad492a 100644 (file)
@@ -22,7 +22,6 @@
 #ifndef PDNS_RECPACKETCACHE_HH
 #define PDNS_RECPACKETCACHE_HH
 #include <string>
-#include <set>
 #include <inttypes.h>
 #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;