BIND 10 trac495, updated. 6483bb374e7ac88e3b736f08bf11e292605aaeef [trac495] do store final answer in cache, but only if noerror

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Mar 2 15:50:00 UTC 2011


The branch, trac495 has been updated
       via  6483bb374e7ac88e3b736f08bf11e292605aaeef (commit)
      from  a3d81c1479c88a8ba26941e351fce1b0b1e3a2ca (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 6483bb374e7ac88e3b736f08bf11e292605aaeef
Author: Jelte Jansen <jelte at isc.org>
Date:   Wed Mar 2 16:49:48 2011 +0100

    [trac495] do store final answer in cache, but only if noerror

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

Summary of changes:
 src/lib/resolve/recursive_query.cc |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/resolve/recursive_query.cc b/src/lib/resolve/recursive_query.cc
index de6f0ef..9baa991 100644
--- a/src/lib/resolve/recursive_query.cc
+++ b/src/lib/resolve/recursive_query.cc
@@ -184,6 +184,10 @@ private:
         if (cache_.lookup(question_.getName(), question_.getType(),
                           question_.getClass(), cached_message)) {
             dlog("Message found in cache, returning that");
+            // Should these be set by the cache too?
+            cached_message.setOpcode(Opcode::QUERY());
+            cached_message.setRcode(Rcode::NOERROR());
+            cached_message.setHeaderFlag(Message::HEADERFLAG_QR);
             if (handleRecursiveAnswer(cached_message)) {
                 callCallback(true);
                 stop();
@@ -261,11 +265,6 @@ private:
 
         bool found_ns_address = false;
             
-        // If the packet is OK, store it in the cache
-        //if (!isc::resolve::ResponseClassifier::error(category)) {
-        //    cache_.update(incoming);
-        //}
-
         switch (category) {
         case isc::resolve::ResponseClassifier::ANSWER:
         case isc::resolve::ResponseClassifier::ANSWERCNAME:
@@ -358,6 +357,7 @@ private:
         case isc::resolve::ResponseClassifier::RCODE:
         case isc::resolve::ResponseClassifier::TRUNCATED:
             dlog("Error in response, returning SERVFAIL");
+            std::cout << "Error: " << category << std::endl;
             // Should we try a different server rather than SERVFAIL?
             makeSERVFAIL();
             return true;
@@ -467,6 +467,9 @@ public:
             // does mean that we overwrite the messages we stored in
             // the previous iteration if we are following a delegation.
             if (success) {
+                if (answer_message_->getRcode() == Rcode::NOERROR()) {
+                    cache_.update(*answer_message_);
+                }
                 resolvercallback_->success(answer_message_);
             } else {
                 resolvercallback_->failure();




More information about the bind10-changes mailing list