BIND 10 trac2539, updated. 8885b2d4e06fc897eee4efdace356c1bd29c771c [2539] Initialize SOA once during construction rather than in getSOA()

BIND 10 source code commits bind10-changes at lists.isc.org
Sun Jan 26 20:39:19 UTC 2014


The branch, trac2539 has been updated
       via  8885b2d4e06fc897eee4efdace356c1bd29c771c (commit)
      from  48da2e4e8966ecf8258e4e818f7aa5223e969abe (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 8885b2d4e06fc897eee4efdace356c1bd29c771c
Author: Kean Johnston <kean at isc.org>
Date:   Sun Jan 26 22:38:11 2014 +0200

    [2539] Initialize SOA once during construction rather than in getSOA()

-----------------------------------------------------------------------

Summary of changes:
 src/lib/datasrc/memory/memory_client.cc |   39 ++++++++++++++-----------------
 1 file changed, 18 insertions(+), 21 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/memory/memory_client.cc b/src/lib/datasrc/memory/memory_client.cc
index 3b57325..2acd0f1 100644
--- a/src/lib/datasrc/memory/memory_client.cc
+++ b/src/lib/datasrc/memory/memory_client.cc
@@ -90,9 +90,9 @@ private:
     ZoneChain chain_;
     const RdataSet* set_node_;
     const RRClass rrclass_;
+    ConstRRsetPtr soa_;
     const ZoneTree& tree_;
     const ZoneNode* node_;
-    const ZoneNode* origin_node_;
     // Only used when separate_rrs_ is true
     ConstRRsetPtr rrset_;
     RdataIteratorPtr rdata_iterator_;
@@ -122,9 +122,22 @@ public:
                       "In-memory zone corrupted, missing origin node");
         }
 
-	// Save the origin node as node_ will be modified during
-	// iteration
-	origin_node_ = node_;
+        if (!node_) {
+            soa_ = ConstRRsetPtr();
+        } else {
+            const RdataSet* origin_set = node_->getData();
+            if (!origin_set) {
+                soa_ = ConstRRsetPtr();
+            } else {
+                const RdataSet* soa = RdataSet::find(origin_set, RRType::SOA());
+                if (!soa) {
+                    soa_ = ConstRRsetPtr();
+                } else {
+                    soa_ = ConstRRsetPtr (new TreeNodeRRset(rrclass_, node_,
+                                                            soa, true));
+                }
+            }
+        }
 
         // Initialize the iterator if there's somewhere to point to
         if (node_ != NULL && node_->getData() != NULL) {
@@ -237,23 +250,7 @@ public:
     }
 
     virtual ConstRRsetPtr getSOA() const {
-        // SOA will be at the origin node
-        if (!origin_node_) {
-            return (ConstRRsetPtr());
-        }
-
-        const RdataSet* origin_set = origin_node_->getData();
-        if (!origin_set) {
-            return (ConstRRsetPtr());
-        }
-
-        const RdataSet* soa = RdataSet::find(origin_set, RRType::SOA());
-        if (!soa) {
-            return (ConstRRsetPtr());
-        }
-
-        return (ConstRRsetPtr
-                (new TreeNodeRRset(rrclass_, origin_node_, soa, true)));
+        return (soa_);
     }
 };
 



More information about the bind10-changes mailing list