[svn] commit: r3306 - in /branches/trac383/src: bin/auth/main.cc bin/recurse/main.cc bin/recurse/recursor.cc bin/recurse/recursor.h bin/recurse/tests/recursor_unittest.cc lib/asiolink/asiolink.h

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Oct 21 12:43:00 UTC 2010


Author: jelte
Date: Thu Oct 21 12:43:00 2010
New Revision: 3306

Log:
auth and recurse now use these new classes (new IOService and DNSService)
removed a few lines that were commented out

Modified:
    branches/trac383/src/bin/auth/main.cc
    branches/trac383/src/bin/recurse/main.cc
    branches/trac383/src/bin/recurse/recursor.cc
    branches/trac383/src/bin/recurse/recursor.h
    branches/trac383/src/bin/recurse/tests/recursor_unittest.cc
    branches/trac383/src/lib/asiolink/asiolink.h

Modified: branches/trac383/src/bin/auth/main.cc
==============================================================================
--- branches/trac383/src/bin/auth/main.cc (original)
+++ branches/trac383/src/bin/auth/main.cc Thu Oct 21 12:43:00 2010
@@ -190,6 +190,8 @@
         DNSLookup* lookup = auth_server->getDNSLookupProvider();
         DNSAnswer* answer = auth_server->getDNSAnswerProvider();
 
+        io_service = new IOService();
+        DNSService* dns_service;
         if (address != NULL) {
             // XXX: we can only specify at most one explicit address.
             // This also means the server cannot run in the dual address
@@ -197,11 +199,11 @@
             // We don't bother to fix this problem, however.  The -a option
             // is a short term workaround until we support dynamic listening
             // port allocation.
-            io_service = new IOService(*port, *address,
-                                       checkin, lookup, answer);
+            dns_service = new DNSService(*io_service,  *port, *address,
+                                     checkin, lookup, answer);
         } else {
-            io_service = new IOService(*port, use_ipv4, use_ipv6,
-                                       checkin, lookup, answer);
+            dns_service = new DNSService(*io_service, *port, use_ipv4,
+                                     use_ipv6, checkin, lookup, answer);
         }
         auth_server->setIOService(*io_service);
         cout << "[b10-auth] IOService created." << endl;

Modified: branches/trac383/src/bin/recurse/main.cc
==============================================================================
--- branches/trac383/src/bin/recurse/main.cc (original)
+++ branches/trac383/src/bin/recurse/main.cc Thu Oct 21 12:43:00 2010
@@ -187,6 +187,9 @@
         DNSLookup* lookup = recursor->getDNSLookupProvider();
         DNSAnswer* answer = recursor->getDNSAnswerProvider();
 
+        io_service = new IOService();
+        DNSService* dns_service;
+
         if (address != NULL) {
             // XXX: we can only specify at most one explicit address.
             // This also means the server cannot run in the dual address
@@ -194,13 +197,13 @@
             // We don't bother to fix this problem, however.  The -a option
             // is a short term workaround until we support dynamic listening
             // port allocation.
-            io_service = new IOService(*port, *address,
+            dns_service = new DNSService(*io_service, *port, *address,
                                        checkin, lookup, answer);
         } else {
-            io_service = new IOService(*port, use_ipv4, use_ipv6,
+            dns_service = new DNSService(*io_service, *port, use_ipv4, use_ipv6,
                                        checkin, lookup, answer);
         }
-        recursor->setIOService(*io_service);
+        recursor->setDNSService(*dns_service);
         cout << "[b10-recurse] IOService created." << endl;
 
         cc_session = new Session(io_service->get_io_service());

Modified: branches/trac383/src/bin/recurse/recursor.cc
==============================================================================
--- branches/trac383/src/bin/recurse/recursor.cc (original)
+++ branches/trac383/src/bin/recurse/recursor.cc Thu Oct 21 12:43:00 2010
@@ -72,8 +72,8 @@
         queryShutdown();
     }
 
-    void querySetup(IOService& ios) {
-        rec_query_ = new RecursiveQuery(ios, forward_);
+    void querySetup(DNSService& dnss) {
+        rec_query_ = new RecursiveQuery(dnss, forward_);
     }
 
     void queryShutdown() {
@@ -295,10 +295,10 @@
 }
 
 void
-Recursor::setIOService(asiolink::IOService& ios) {
+Recursor::setDNSService(asiolink::DNSService& dnss) {
     impl_->queryShutdown();
-    impl_->querySetup(ios);
-    io_ = &ios;
+    impl_->querySetup(dnss);
+    dnss_ = &dnss;
 }
 
 void

Modified: branches/trac383/src/bin/recurse/recursor.h
==============================================================================
--- branches/trac383/src/bin/recurse/recursor.h (original)
+++ branches/trac383/src/bin/recurse/recursor.h Thu Oct 21 12:43:00 2010
@@ -65,10 +65,10 @@
     isc::data::ConstElementPtr updateConfig(isc::data::ConstElementPtr config);
 
     /// \brief Assign an ASIO IO Service queue to this Recursor object
-    void setIOService(asiolink::IOService& ios);
+    void setDNSService(asiolink::DNSService& dnss);
 
     /// \brief Return this object's ASIO IO Service queue
-    asiolink::IOService& getIOService() const { return (*io_); }
+    asiolink::DNSService& getDNSService() const { return (*dnss_); }
 
     /// \brief Return pointer to the DNS Lookup callback function
     asiolink::DNSLookup* getDNSLookupProvider() { return (dns_lookup_); }
@@ -81,7 +81,7 @@
 
 private:
     RecursorImpl* impl_;
-    asiolink::IOService* io_;
+    asiolink::DNSService* dnss_;
     asiolink::SimpleCallback* checkin_;
     asiolink::DNSLookup* dns_lookup_;
     asiolink::DNSAnswer* dns_answer_;

Modified: branches/trac383/src/bin/recurse/tests/recursor_unittest.cc
==============================================================================
--- branches/trac383/src/bin/recurse/tests/recursor_unittest.cc (original)
+++ branches/trac383/src/bin/recurse/tests/recursor_unittest.cc Thu Oct 21 12:43:00 2010
@@ -63,16 +63,17 @@
 
 class RecursorTest : public ::testing::Test {
 protected:
-    RecursorTest() : ios(*TEST_PORT, true, false, NULL, NULL, NULL),
-                    server(*DEFAULT_REMOTE_ADDRESS),
-                    request_message(Message::RENDER),
-                    parse_message(new Message(Message::PARSE)),
-                    default_qid(0x1035), opcode(Opcode(Opcode::QUERY())),
-                    qname("www.example.com"),
-                    qclass(RRClass::IN()), qtype(RRType::A()),
-                    io_message(NULL), endpoint(NULL), request_obuffer(0),
-                    request_renderer(request_obuffer),
-                    response_obuffer(new OutputBuffer(0))
+    RecursorTest() : ios(),
+                     dnss(ios, *TEST_PORT, true, false, NULL, NULL, NULL),
+                     server(*DEFAULT_REMOTE_ADDRESS),
+                     request_message(Message::RENDER),
+                     parse_message(new Message(Message::PARSE)),
+                     default_qid(0x1035), opcode(Opcode(Opcode::QUERY())),
+                     qname("www.example.com"),
+                     qclass(RRClass::IN()), qtype(RRType::A()),
+                     io_message(NULL), endpoint(NULL), request_obuffer(0),
+                     request_renderer(request_obuffer),
+                     response_obuffer(new OutputBuffer(0))
     {}
     ~RecursorTest() {
         delete io_message;
@@ -81,6 +82,7 @@
     MockSession notify_session;
     MockServer dnsserv;
     IOService ios;
+    DNSService dnss;
     Recursor server;
     Message request_message;
     MessagePtr parse_message;

Modified: branches/trac383/src/lib/asiolink/asiolink.h
==============================================================================
--- branches/trac383/src/lib/asiolink/asiolink.h (original)
+++ branches/trac383/src/lib/asiolink/asiolink.h Thu Oct 21 12:43:00 2010
@@ -204,24 +204,6 @@
     ~DNSService();
     //@}
 
-    /// \brief Start the underlying event loop.
-    ///
-    /// This method does not return control to the caller until
-    /// the \c stop() method is called via some handler.
-//    void run();
-
-    /// \brief Run the underlying event loop for a single event.
-    ///
-    /// This method return control to the caller as soon as the
-    /// first handler has completed.  (If no handlers are ready when
-    /// it is run, it will block until one is.)
-//    void run_one();
-
-    /// \brief Stop the underlying event loop.
-    ///
-    /// This will return the control to the caller of the \c run() method.
-//    void stop();
-
     /// \brief Return the native \c io_service object used in this wrapper.
     ///
     /// This is a short term work around to support other BIND 10 modules




More information about the bind10-changes mailing list