Browse Source

relatively minor cleanup: move a big constructor logic to .cc

git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@1103 e5f2f494-b856-4b98-b285-d166d9295462
JINMEI Tatuya 15 years ago
parent
commit
840c1d8b6e
2 changed files with 20 additions and 21 deletions
  1. 19 0
      src/lib/auth/cpp/query.cc
  2. 1 21
      src/lib/auth/cpp/query.h

+ 19 - 0
src/lib/auth/cpp/query.cc

@@ -26,6 +26,25 @@
 namespace isc {
 namespace auth {
 
+Query::Query(Message& m, bool dnssec) :
+    status_(PENDING), qname_(NULL), qclass_(NULL), qtype_(NULL),
+    message_(&m), want_additional_(true), want_dnssec_(dnssec)
+{
+    // Check message formatting
+    if (message_->getRRCount(Section::QUESTION()) != 1) {
+        dns_throw(Unexpected, "malformed message: too many questions");
+    }
+
+    // Populate the query task queue with the initial question
+    QuestionPtr question = *message_->beginQuestion();
+    qname_ = &question->getName();
+    qclass_ = &question->getClass();
+    qtype_ = &question->getType();
+
+    querytasks_.push(QueryTaskPtr(new QueryTask(*qname_, *qclass_, *qtype_,
+                                                Section::ANSWER())));
+}
+
 // Destructors defined here to avoid confusing the linker
 QueryTask::~QueryTask() {}
 Query::~Query() {}

+ 1 - 21
src/lib/auth/cpp/query.h

@@ -187,27 +187,7 @@ public:
     };
 
     // Query constructor
-    Query(Message& m, bool dnssec) {
-        message_ = &m;
-        want_additional_ = true;
-        want_dnssec_ = dnssec;
-        status_ = PENDING;
-
-        // Check message formatting
-        if (message_->getRRCount(Section::QUESTION()) != 1) {
-            dns_throw(Unexpected, "malformed message: too many questions");
-        }
-
-        // Populate the query task queue with the initial question
-        QuestionPtr query = *message_->beginQuestion();
-        qname_ = &query->getName();
-        qclass_ = &query->getClass();
-        qtype_ = &query->getType();
-
-        QueryTaskPtr initial_task(new QueryTask(*qname_, *qclass_, *qtype_,
-                                                Section::ANSWER()));
-        querytasks_.push(initial_task);
-    };
+    Query(Message& m, bool dnssec);
 
     virtual ~Query();