BIND 10 trac388, updated. c3d81863bc201dc1fab9690565158b8f09d61061 [trac388] Fix rethrowing of exception

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Feb 24 14:33:51 UTC 2011


The branch, trac388 has been updated
       via  c3d81863bc201dc1fab9690565158b8f09d61061 (commit)
       via  199599a979e331026ec5dc8ff07f1bb08f3228e9 (commit)
       via  d7ec12be1f1e87ca0cc4675165f126f8d010b6b3 (commit)
       via  b7d8ac6afdd51bb18fcb0c1c0f7389d4975f7c54 (commit)
      from  354ca192db138bdd942734ff985b6e21c8445a82 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c3d81863bc201dc1fab9690565158b8f09d61061
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Thu Feb 24 15:26:46 2011 +0100

    [trac388] Fix rethrowing of exception
    
    If the e is used explicitly, the type is lost (even when it shouldn't
    probably be, as we catch it as a reference). This way the type is
    preserved, allowing other catches on the stack handle it properly.

commit 199599a979e331026ec5dc8ff07f1bb08f3228e9
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Thu Feb 24 15:15:43 2011 +0100

    [trac388] Enable port config test in resolver
    
    It needed to close sockets to be able to successfully roll back in case
    of failure.

commit d7ec12be1f1e87ca0cc4675165f126f8d010b6b3
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Thu Feb 24 15:13:03 2011 +0100

    [trac388] Enable clearServers test

commit b7d8ac6afdd51bb18fcb0c1c0f7389d4975f7c54
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Thu Feb 24 14:50:19 2011 +0100

    [trac388] Formatting fix of Changelog

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                          |    5 +++--
 src/bin/resolver/resolver.cc                       |    4 ++--
 src/bin/resolver/tests/resolver_config_unittest.cc |    5 +----
 src/lib/asiolink/dns_service.cc                    |    6 ++++--
 src/lib/asiolink/tests/recursive_query_unittest.cc |    4 +---
 5 files changed, 11 insertions(+), 13 deletions(-)

-----------------------------------------------------------------------
diff --git a/ChangeLog b/ChangeLog
index f6a205f..2ba8522 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,8 @@
-	172.  [func] 	feng
+  172.  [func]      feng
 	Add stop interface into dns server, so we can stop each running
-	server individually.With it, user can reconfigure its running server
+	server individually. With it, user can reconfigure her running server
 	with different ip address or port.
+	(Trac #388, git TBD)
 
   171.  [func]      feng, jerry, jinmei, vorner
 	b10-auth, src/lib/datasrc: in memory data source now works as a
diff --git a/src/bin/resolver/resolver.cc b/src/bin/resolver/resolver.cc
index dfd84a6..5cde3b4 100644
--- a/src/bin/resolver/resolver.cc
+++ b/src/bin/resolver/resolver.cc
@@ -633,7 +633,7 @@ Resolver::setListenAddresses(const vector<addr_t>& addresses) {
         setAddresses(dnss_, addresses);
         impl_->listen_ = addresses;
     }
-    catch (const exception& e) {
+    catch (exception& e) {
         /*
          * We couldn't set it. So return it back. If that fails as well,
          * we have a problem.
@@ -650,7 +650,7 @@ Resolver::setListenAddresses(const vector<addr_t>& addresses) {
             dlog(string("Rollback failed with: ") + e2.what(),true);
             abort();
         }
-        throw e; // Let it fly a little bit further
+        throw; // Let it fly a little bit further
     }
 }
 
diff --git a/src/bin/resolver/tests/resolver_config_unittest.cc b/src/bin/resolver/tests/resolver_config_unittest.cc
index 916396a..2609049 100644
--- a/src/bin/resolver/tests/resolver_config_unittest.cc
+++ b/src/bin/resolver/tests/resolver_config_unittest.cc
@@ -174,7 +174,7 @@ TEST_F(ResolverConfig, listenAddresses) {
     EXPECT_TRUE(server.getListenAddresses().empty());
 }
 
-TEST_F(ResolverConfig, DISABLED_listenAddressConfig) {
+TEST_F(ResolverConfig, listenAddressConfig) {
     // Try putting there some address
     ElementPtr config(Element::fromJSON("{"
         "\"listen_on\": ["
@@ -192,9 +192,6 @@ TEST_F(ResolverConfig, DISABLED_listenAddressConfig) {
 
     // As this is example address, the machine should not have it on
     // any interface
-    // FIXME: This test aborts, because it tries to rollback and
-    //     it is impossible, since the sockets are not closed.
-    //     Once #388 is solved, enable this test.
     config = Element::fromJSON("{"
         "\"listen_on\": ["
         "   {"
diff --git a/src/lib/asiolink/dns_service.cc b/src/lib/asiolink/dns_service.cc
index 98ca032..fee2a32 100644
--- a/src/lib/asiolink/dns_service.cc
+++ b/src/lib/asiolink/dns_service.cc
@@ -26,6 +26,7 @@
 #include <log/dummylog.h>
 
 #include <boost/lexical_cast.hpp>
+#include <boost/foreach.hpp>
 
 using isc::log::dlog;
 
@@ -182,8 +183,9 @@ DNSService::addServer(uint16_t port, const std::string& address) {
 
 void
 DNSService::clearServers() {
-    // FIXME: This does not work, it does not close the socket.
-    // How is it done?
+    BOOST_FOREACH(const DNSServiceImpl::DNSServerPtr& s, impl_->servers_) {
+        s->stop();
+    }
     impl_->servers_.clear();
 }
 
diff --git a/src/lib/asiolink/tests/recursive_query_unittest.cc b/src/lib/asiolink/tests/recursive_query_unittest.cc
index ad4e5b4..0fd7e62 100644
--- a/src/lib/asiolink/tests/recursive_query_unittest.cc
+++ b/src/lib/asiolink/tests/recursive_query_unittest.cc
@@ -480,9 +480,7 @@ TEST_F(RecursiveQueryTest, v4AddServer) {
     EXPECT_THROW(sendTCP(AF_INET6), IOError);
 }
 
-TEST_F(RecursiveQueryTest, DISABLED_clearServers) {
-    // FIXME: Enable when clearServers actually close the sockets
-    //    See #388
+TEST_F(RecursiveQueryTest, clearServers) {
     setDNSService();
     dns_service_->clearServers();
 




More information about the bind10-changes mailing list