[svn] commit: r3659 - /branches/vorner-recursor-timeouts/src/bin/recurse/recursor.cc

BIND 10 source code commits bind10-changes at lists.isc.org
Mon Nov 29 15:35:40 UTC 2010


Author: vorner
Date: Mon Nov 29 15:35:40 2010
New Revision: 3659

Log:
Cleanup & comment of lambda classes

Modified:
    branches/vorner-recursor-timeouts/src/bin/recurse/recursor.cc

Modified: branches/vorner-recursor-timeouts/src/bin/recurse/recursor.cc
==============================================================================
--- branches/vorner-recursor-timeouts/src/bin/recurse/recursor.cc (original)
+++ branches/vorner-recursor-timeouts/src/bin/recurse/recursor.cc Mon Nov 29 15:35:40 2010
@@ -130,6 +130,11 @@
     RecursiveQuery* rec_query_;
 };
 
+/*
+ * std::for_each has a broken interface. It makes no sense in a language
+ * without lambda functions/closures. These two classes emulate the lambda
+ * functions so for_each can be used.
+ */
 class QuestionInserter {
 public:
     QuestionInserter(MessagePtr message) : message_(message) {}
@@ -143,9 +148,8 @@
 
 class SectionInserter {
 public:
-    SectionInserter(MessagePtr message, const Message::Section sect,
-        bool sign) :
-        message_(message), section_(sect), sign_(sign)
+    SectionInserter(MessagePtr message, const Message::Section sect) :
+        message_(message), section_(sect)
     {}
     void operator()(const RRsetPtr rrset) {
         dlog("Adding RRSet to message section " +
@@ -154,7 +158,6 @@
     }
     MessagePtr message_;
     const Message::Section section_;
-    bool sign_;
 };
 
 void
@@ -259,16 +262,13 @@
                 incoming.fromWire(ibuf);
                 for_each(incoming.beginSection(Message::SECTION_ANSWER),
                          incoming.endSection(Message::SECTION_ANSWER),
-                         SectionInserter(message, Message::SECTION_ANSWER,
-                         true));
+                         SectionInserter(message, Message::SECTION_ANSWER));
                 for_each(incoming.beginSection(Message::SECTION_ADDITIONAL),
                          incoming.endSection(Message::SECTION_ADDITIONAL),
-                         SectionInserter(message, Message::SECTION_ADDITIONAL,
-                         true));
+                         SectionInserter(message, Message::SECTION_ADDITIONAL));
                 for_each(incoming.beginSection(Message::SECTION_AUTHORITY),
                          incoming.endSection(Message::SECTION_ADDITIONAL),
-                         SectionInserter(message, Message::SECTION_AUTHORITY,
-                         true));
+                         SectionInserter(message, Message::SECTION_AUTHORITY));
             } catch (const Exception& ex) {
                 // Incoming message couldn't be read, we just SERVFAIL
                 message->setRcode(Rcode::SERVFAIL());




More information about the bind10-changes mailing list