Parcourir la source

[2218] Work inside the subtree under the origin's node only

Mukund Sivaraman il y a 12 ans
Parent
commit
d0a412aedd
1 fichiers modifiés avec 10 ajouts et 8 suppressions
  1. 10 8
      src/lib/datasrc/memory/zone_finder.cc

+ 10 - 8
src/lib/datasrc/memory/zone_finder.cc

@@ -699,19 +699,21 @@ InMemoryZoneFinder::findNSEC3(const isc::dns::Name& name, bool recursive) {
 
             return (FindNSEC3Result(true, labels, closest, next));
         } else {
-            const NameComparisonResult& cmp = chain.getLastComparisonResult();
-            assert(cmp.getOrder() != 0);
+            const NameComparisonResult& last_cmp =
+                chain.getLastComparisonResult();
+            const ZoneNode* last_node = chain.getLastComparedNode();
+            assert(last_cmp.getOrder() != 0);
 
-            // find() finished in between these two:
-            const ZoneNode* previous_node = tree.previousNode(chain);
-            const ZoneNode* next_node = tree.nextNode(chain);
+            // find() finished in between one of these and last_node:
+            const ZoneNode* previous_node = last_node->predecessor();
+            const ZoneNode* next_node = last_node->successor();
 
             // If the given hash is larger than the largest stored hash or
             // the first label doesn't match the target, identify the "previous"
             // hash value and remember it as the candidate next closer proof.
-            if (((cmp.getOrder() < 0) && (previous_node == NULL)) ||
-                ((cmp.getOrder() > 0) && (next_node == NULL))) {
-                covering_node = tree.getLargestNode();
+            if (((last_cmp.getOrder() < 0) && (previous_node == NULL)) ||
+                ((last_cmp.getOrder() > 0) && (next_node == NULL))) {
+                covering_node = last_node->getLargestInSubTree();
             } else {
                 // Otherwise, H(found_entry-1) < given_hash < H(found_entry).
                 // The covering proof is the first one (and it's valid