]> granicus.if.org Git - pdns/commitdiff
rec: Pass a ref to an optional pb message for pkt cache insertion
authorRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 6 Apr 2018 14:01:57 +0000 (16:01 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 6 Apr 2018 14:01:57 +0000 (16:01 +0200)
pdns/recpacketcache.cc
pdns/recpacketcache.hh

index f895c2222f84a9217a64bebbf63a31fcab12c999..354c3d47a972f9f74a574b7888d809476a4cc661 100644 (file)
@@ -143,10 +143,11 @@ bool RecursorPacketCache::getResponsePacket(unsigned int tag, const std::string&
 
 void RecursorPacketCache::insertResponsePacket(unsigned int tag, uint32_t qhash, const DNSName& qname, uint16_t qtype, uint16_t qclass, const std::string& responsePacket, time_t now, uint32_t ttl)
 {
-  insertResponsePacket(tag, qhash, qname, qtype, qclass, responsePacket, now, ttl, boost::none);
+  boost::optional<RecProtoBufMessage> pb(boost::none);
+  insertResponsePacket(tag, qhash, qname, qtype, qclass, responsePacket, now, ttl, pb);
 }
 
-void RecursorPacketCache::insertResponsePacket(unsigned int tag, uint32_t qhash, const DNSName& qname, uint16_t qtype, uint16_t qclass, const std::string& responsePacket, time_t now, uint32_t ttl, boost::optional<RecProtoBufMessage> protobufMessage)
+void RecursorPacketCache::insertResponsePacket(unsigned int tag, uint32_t qhash, const DNSName& qname, uint16_t qtype, uint16_t qclass, const std::string& responsePacket, time_t now, uint32_t ttl, const boost::optional<RecProtoBufMessage>& protobufMessage)
 {
   auto& idx = d_packetCache.get<HashTag>();
   auto range = idx.equal_range(tie(tag,qhash));
index 9b2ac0e719be439416431fb701a259d677d00138..40c94e94f59fd08c6436ea1d9557bc48fa877c40 100644 (file)
@@ -57,7 +57,7 @@ public:
   bool getResponsePacket(unsigned int tag, const std::string& queryPacket, const DNSName& qname, uint16_t qtype, uint16_t qclass, time_t now, std::string* responsePacket, uint32_t* age, uint32_t* qhash);
   bool getResponsePacket(unsigned int tag, const std::string& queryPacket, const DNSName& qname, uint16_t qtype, uint16_t qclass, time_t now, std::string* responsePacket, uint32_t* age, uint32_t* qhash, RecProtoBufMessage* protobufMessage);
   void insertResponsePacket(unsigned int tag, uint32_t qhash, const DNSName& qname, uint16_t qtype, uint16_t qclass, const std::string& responsePacket, time_t now, uint32_t ttl);
-  void insertResponsePacket(unsigned int tag, uint32_t qhash, const DNSName& qname, uint16_t qtype, uint16_t qclass, const std::string& responsePacket, time_t now, uint32_t ttl, boost::optional<RecProtoBufMessage> protobufMessage);
+  void insertResponsePacket(unsigned int tag, uint32_t qhash, const DNSName& qname, uint16_t qtype, uint16_t qclass, const std::string& responsePacket, time_t now, uint32_t ttl, const boost::optional<RecProtoBufMessage>& protobufMessage);
   void doPruneTo(unsigned int maxSize=250000);
   uint64_t doDump(int fd);
   int doWipePacketCache(const DNSName& name, uint16_t qtype=0xffff, bool subtree=false);