Browse Source

Cleanup & comment of lambda classes

git-svn-id: svn://bind10.isc.org/svn/bind10/branches/vorner-recursor-timeouts@3659 e5f2f494-b856-4b98-b285-d166d9295462
Michal Vaner 14 years ago
parent
commit
57fa2206e4
1 changed files with 10 additions and 10 deletions
  1. 10 10
      src/bin/recurse/recursor.cc

+ 10 - 10
src/bin/recurse/recursor.cc

@@ -130,6 +130,11 @@ private:
     RecursiveQuery* rec_query_;
     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 {
 class QuestionInserter {
 public:
 public:
     QuestionInserter(MessagePtr message) : message_(message) {}
     QuestionInserter(MessagePtr message) : message_(message) {}
@@ -143,9 +148,8 @@ public:
 
 
 class SectionInserter {
 class SectionInserter {
 public:
 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) {
     void operator()(const RRsetPtr rrset) {
         dlog("Adding RRSet to message section " +
         dlog("Adding RRSet to message section " +
@@ -154,7 +158,6 @@ public:
     }
     }
     MessagePtr message_;
     MessagePtr message_;
     const Message::Section section_;
     const Message::Section section_;
-    bool sign_;
 };
 };
 
 
 void
 void
@@ -259,16 +262,13 @@ public:
                 incoming.fromWire(ibuf);
                 incoming.fromWire(ibuf);
                 for_each(incoming.beginSection(Message::SECTION_ANSWER),
                 for_each(incoming.beginSection(Message::SECTION_ANSWER),
                          incoming.endSection(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),
                 for_each(incoming.beginSection(Message::SECTION_ADDITIONAL),
                          incoming.endSection(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),
                 for_each(incoming.beginSection(Message::SECTION_AUTHORITY),
                          incoming.endSection(Message::SECTION_ADDITIONAL),
                          incoming.endSection(Message::SECTION_ADDITIONAL),
-                         SectionInserter(message, Message::SECTION_AUTHORITY,
-                         true));
+                         SectionInserter(message, Message::SECTION_AUTHORITY));
             } catch (const Exception& ex) {
             } catch (const Exception& ex) {
                 // Incoming message couldn't be read, we just SERVFAIL
                 // Incoming message couldn't be read, we just SERVFAIL
                 message->setRcode(Rcode::SERVFAIL());
                 message->setRcode(Rcode::SERVFAIL());