[svn] commit: r3556 - in /branches/vorner-recursor-dummylog/src: bin/recurse/main.cc bin/recurse/recursor.cc lib/asiolink/asiolink.cc lib/asiolink/udpdns.cc

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Nov 17 22:17:29 UTC 2010


Author: vorner
Date: Wed Nov 17 22:17:29 2010
New Revision: 3556

Log:
Some more logging messages

Modified:
    branches/vorner-recursor-dummylog/src/bin/recurse/main.cc
    branches/vorner-recursor-dummylog/src/bin/recurse/recursor.cc
    branches/vorner-recursor-dummylog/src/lib/asiolink/asiolink.cc
    branches/vorner-recursor-dummylog/src/lib/asiolink/udpdns.cc

Modified: branches/vorner-recursor-dummylog/src/bin/recurse/main.cc
==============================================================================
--- branches/vorner-recursor-dummylog/src/bin/recurse/main.cc (original)
+++ branches/vorner-recursor-dummylog/src/bin/recurse/main.cc Wed Nov 17 22:17:29 2010
@@ -22,7 +22,7 @@
 #include <stdlib.h>
 #include <errno.h>
 
-#include <cassert>
+#include <string>
 #include <iostream>
 
 #include <boost/foreach.hpp>
@@ -166,6 +166,14 @@
         usage();
     }
 
+    if (isc::log::denabled) { // Show the command line
+        string cmdline("Command line:");
+        for (int i = 0; i < argc; ++ i) {
+            cmdline = cmdline + " " + argv[i];
+        }
+        dlog(cmdline);
+    }
+
     int ret = 0;
 
     // XXX: we should eventually pass io_service here.

Modified: branches/vorner-recursor-dummylog/src/bin/recurse/recursor.cc
==============================================================================
--- branches/vorner-recursor-dummylog/src/bin/recurse/recursor.cc (original)
+++ branches/vorner-recursor-dummylog/src/bin/recurse/recursor.cc Wed Nov 17 22:17:29 2010
@@ -114,7 +114,8 @@
         message_(message), section_(sect), sign_(sign)
     {}
     void operator()(const RRsetPtr rrset) {
-        dlog("Adding RRSet to message");
+        dlog("Adding RRSet to message section " +
+            boost::lexical_cast<string>(section_.getCode()));
         message_->addRRset(section_, rrset, true);
     }
     MessagePtr message_;
@@ -354,10 +355,15 @@
     bool sendAnswer = true;
     if (message->getOpcode() == Opcode::NOTIFY()) {
         makeErrorMessage(message, buffer, Rcode::NOTAUTH());
+        dlog("Notify arrived, but we are not authoritative");
     } else if (message->getOpcode() != Opcode::QUERY()) {
-        dlog("unsupported opcode");
+        dlog("Unsupported opcode (got: " + message->getOpcode().toText() +
+            ", expected: " + Opcode::QUERY().toText());
         makeErrorMessage(message, buffer, Rcode::NOTIMP());
     } else if (message->getRRCount(Section::QUESTION()) != 1) {
+        dlog("The query contained " +
+            boost::lexical_cast<string>(message->getRRCount(
+            Section::QUESTION()) + " questions, exactly one expected"));
         makeErrorMessage(message, buffer, Rcode::FORMERR());
     } else {
         ConstQuestionPtr question = *message->beginQuestion();

Modified: branches/vorner-recursor-dummylog/src/lib/asiolink/asiolink.cc
==============================================================================
--- branches/vorner-recursor-dummylog/src/lib/asiolink/asiolink.cc (original)
+++ branches/vorner-recursor-dummylog/src/lib/asiolink/asiolink.cc Wed Nov 17 22:17:29 2010
@@ -234,7 +234,8 @@
 RecursiveQuery::sendQuery(const Question& question, OutputBufferPtr buffer,
                           DNSServer* server)
 {
-    dlog("Sending upstream query to " + ns_addr_.toText());
+    dlog("Sending upstream query (" + question.toText() + ") to " +
+        ns_addr_.toText());
     // XXX: eventually we will need to be able to determine whether
     // the message should be sent via TCP or UDP, or sent initially via
     // UDP and then fall back to TCP on failure, but for the moment

Modified: branches/vorner-recursor-dummylog/src/lib/asiolink/udpdns.cc
==============================================================================
--- branches/vorner-recursor-dummylog/src/lib/asiolink/udpdns.cc (original)
+++ branches/vorner-recursor-dummylog/src/lib/asiolink/udpdns.cc Wed Nov 17 22:17:29 2010
@@ -29,6 +29,7 @@
 #include <dns/buffer.h>
 #include <dns/message.h>
 #include <dns/messagerenderer.h>
+#include <log/dummylog.h>
 
 #include <asiolink.h>
 #include <internal/coroutine.h>
@@ -37,6 +38,7 @@
 using namespace asio;
 using asio::ip::udp;
 using asio::ip::tcp;
+using isc::log::dlog;
 
 using namespace std;
 using namespace isc::dns;
@@ -208,6 +210,8 @@
             msg.addQuestion(question_);
             MessageRenderer renderer(*msgbuf_);
             msg.toWire(renderer);
+            dlog("Sending " + msg.toText() + " to " +
+                remote_.address().to_string());
         }
 
         // Begin an asynchronous send, and then yield.  When the
@@ -224,6 +228,8 @@
         /// completes, we will resume immediately after this point.
         CORO_YIELD socket_->async_receive_from(buffer(data_.get(), MAX_LENGTH),
                                                remote_, *this);
+        // The message is not rendered yet, so we can't print it easilly
+        dlog("Received response from " + remote_.address().to_string());
 
         /// Copy the answer into the response buffer.  (XXX: If the
         /// OutputBuffer object were made to meet the requirements of




More information about the bind10-changes mailing list