[svn] commit: r3388 - in /branches/vorner-recursor-config/src: bin/recurse/recursor.cc bin/recurse/tests/recursor_unittest.cc lib/asiolink/tests/asiolink_unittest.cc

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Oct 28 09:40:32 UTC 2010


Author: vorner
Date: Thu Oct 28 09:40:23 2010
New Revision: 3388

Log:
Abort when rollback fails

Disabled one test that couldn't rollback because of #388.

Added notes what should be enabled and fixed after #388 and #384.

Modified:
    branches/vorner-recursor-config/src/bin/recurse/recursor.cc
    branches/vorner-recursor-config/src/bin/recurse/tests/recursor_unittest.cc
    branches/vorner-recursor-config/src/lib/asiolink/tests/asiolink_unittest.cc

Modified: branches/vorner-recursor-config/src/bin/recurse/recursor.cc
==============================================================================
--- branches/vorner-recursor-config/src/bin/recurse/recursor.cc (original)
+++ branches/vorner-recursor-config/src/bin/recurse/recursor.cc Thu Oct 28 09:40:23 2010
@@ -498,6 +498,9 @@
     }
     try {
         // Parse forward_addresses
+        // FIXME Once the config parser is fixed, remove the slashes. They
+        // appear only on the default/startup value and shouldn't be here.
+        // See ticket #384
         ConstElementPtr forwardAddressesE(config->get("forward_addresses/"));
         vector<addr_t> forwardAddresses(parseAddresses(forwardAddressesE));
         ConstElementPtr listenAddressesE(config->get("listen_on/"));
@@ -553,15 +556,23 @@
         setAddresses(io_, addresses);
         impl_->listen_ = addresses;
     }
-    catch (const exception &e) {
+    catch (const exception& e) {
         /*
          * We couldn't set it. So return it back. If that fails as well,
          * we have a problem.
          *
-         * FIXME: What to do in that case? Directly abort?
+         * If that fails, bad luck, but we are useless anyway, so just die
+         * and let boss start us again.
          */
-        setAddresses(io_, impl_->listen_);
-        throw e;// Let it fly a little bit further
+        try {
+            setAddresses(io_, impl_->listen_);
+        }
+        catch (const exception& e2) {
+            cerr << "[b10-recurse] Unable to recover from error: " << e.what()
+                << endl << "Rollback failed with: " << e2.what() << endl;
+            abort();
+        }
+        throw e; // Let it fly a little bit further
     }
 }
 

Modified: branches/vorner-recursor-config/src/bin/recurse/tests/recursor_unittest.cc
==============================================================================
--- branches/vorner-recursor-config/src/bin/recurse/tests/recursor_unittest.cc (original)
+++ branches/vorner-recursor-config/src/bin/recurse/tests/recursor_unittest.cc Thu Oct 28 09:40:23 2010
@@ -445,7 +445,7 @@
     EXPECT_TRUE(server.getListenAddresses().empty());
 }
 
-TEST_F(RecursorConfig, listenAddressConfig) {
+TEST_F(RecursorConfig, DISABLED_listenAddressConfig) {
     // Try putting there some address
     ElementPtr config(Element::fromJSON("{"
         "\"listen_on/\": ["
@@ -463,6 +463,9 @@
 
     // 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/\": ["
         "   {"

Modified: branches/vorner-recursor-config/src/lib/asiolink/tests/asiolink_unittest.cc
==============================================================================
--- branches/vorner-recursor-config/src/lib/asiolink/tests/asiolink_unittest.cc (original)
+++ branches/vorner-recursor-config/src/lib/asiolink/tests/asiolink_unittest.cc Thu Oct 28 09:40:23 2010
@@ -541,6 +541,7 @@
 
 TEST_F(ASIOLinkTest, DISABLED_clearServers) {
     // FIXME: Enable when clearServers actually close the sockets
+    //    See #388
     io_service_->clearServers();
 
     EXPECT_THROW(sendTCP(AF_INET), IOError);




More information about the bind10-changes mailing list