Parcourir la source

Merge branch 'trac1796'

Mukund Sivaraman il y a 11 ans
Parent
commit
99ca75676a
2 fichiers modifiés avec 12 ajouts et 14 suppressions
  1. 0 14
      src/bin/auth/query.cc
  2. 12 0
      src/bin/auth/query.h

+ 0 - 14
src/bin/auth/query.cc

@@ -37,20 +37,6 @@ using namespace isc::dns;
 using namespace isc::datasrc;
 using namespace isc::dns::rdata;
 
-// This is a "constant" vector storing desired RR types for the additional
-// section.  The vector is filled first time it's used.
-namespace {
-const vector<RRType>&
-A_AND_AAAA() {
-    static vector<RRType> needed_types;
-    if (needed_types.empty()) {
-        needed_types.push_back(RRType::A());
-        needed_types.push_back(RRType::AAAA());
-    }
-    return (needed_types);
-}
-}
-
 namespace isc {
 namespace auth {
 

+ 12 - 0
src/bin/auth/query.h

@@ -286,6 +286,9 @@ public:
         answers_.reserve(RESERVE_RRSETS);
         authorities_.reserve(RESERVE_RRSETS);
         additionals_.reserve(RESERVE_RRSETS);
+
+        a_and_aaaa_.push_back(isc::dns::RRType::A());
+        a_and_aaaa_.push_back(isc::dns::RRType::AAAA());
     }
 
 
@@ -488,6 +491,15 @@ private:
     std::vector<isc::dns::ConstRRsetPtr> answers_;
     std::vector<isc::dns::ConstRRsetPtr> authorities_;
     std::vector<isc::dns::ConstRRsetPtr> additionals_;
+
+private:
+    /// \brief Returns a reference to a pre-initialized vector (see the
+    /// \c Query constructor).
+    const std::vector<isc::dns::RRType>& A_AND_AAAA() const {
+        return (a_and_aaaa_);
+    }
+
+    std::vector<isc::dns::RRType> a_and_aaaa_;
 };
 
 }