BIND 10 trac775, updated. 660d7d782c81bc55b8cc009836c35d9ca3948063 [trac775] fix the bug that if name server bind port failed, name server will exist, in that case, we can't reset the port number

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Apr 14 08:02:10 UTC 2011


The branch, trac775 has been updated
       via  660d7d782c81bc55b8cc009836c35d9ca3948063 (commit)
      from  e23c4b1e90ba1127a5b7eaef4add6f3b68fbc6fa (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 660d7d782c81bc55b8cc009836c35d9ca3948063
Author: hanfeng <ben.han.cn at gmail.com>
Date:   Thu Apr 14 16:01:48 2011 +0800

    [trac775] fix the bug that if name server bind port failed, name server will exist, in that case, we can't reset the port number

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

Summary of changes:
 src/lib/server_common/portconfig.cc                |   16 ++++++++++------
 src/lib/server_common/tests/portconfig_unittest.cc |    2 +-
 2 files changed, 11 insertions(+), 7 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/server_common/portconfig.cc b/src/lib/server_common/portconfig.cc
index 3765f52..3fc81e3 100644
--- a/src/lib/server_common/portconfig.cc
+++ b/src/lib/server_common/portconfig.cc
@@ -95,11 +95,17 @@ installListenAddresses(const AddressList& newAddresses,
     }
     catch (const exception& e) {
         /*
-         * We couldn't set it. So return it back. If that fails as well,
-         * we have a problem.
+         * If one of the addresses isn't set successfully, we will restore
+         * the old addresses, the behavior is that either all address are
+         * set successuflly or none of them will be used. whether this
+         * behavior is user desired, maybe we need revisited it later. And
+         * if address setting is more smarter, it should check whether some
+         * part of the new address already in used to avoid interuption the
+         * service.
          *
-         * If that fails, bad luck, but we are useless anyway, so just die
-         * and let boss start us again.
+         * If the address setting still failed, we can live with it, since
+         * user will get error info, command control can be used to set new
+         * address. So we just catch the exception without propagating outside
          */
         dlog(string("Unable to set new address: ") + e.what(), true);
         try {
@@ -108,9 +114,7 @@ installListenAddresses(const AddressList& newAddresses,
         catch (const exception& e2) {
             dlog("Unable to recover from error;", true);
             dlog(string("Rollback failed with: ") + e2.what(), true);
-            abort();
         }
-        throw; // Let it fly a little bit further
     }
 }
 
diff --git a/src/lib/server_common/tests/portconfig_unittest.cc b/src/lib/server_common/tests/portconfig_unittest.cc
index fabdfa2..a74ad3c 100644
--- a/src/lib/server_common/tests/portconfig_unittest.cc
+++ b/src/lib/server_common/tests/portconfig_unittest.cc
@@ -175,7 +175,7 @@ TEST_F(InstallListenAddresses, rollback) {
     EXPECT_NO_THROW(installListenAddresses(valid_, store_, dnss_));
     checkAddresses(valid_, "Before rollback");
     // This should not bind them, but should leave the original addresses
-    EXPECT_THROW(installListenAddresses(invalid_, store_, dnss_), IOError);
+    EXPECT_NO_THROW(installListenAddresses(invalid_, store_, dnss_));
     checkAddresses(valid_, "After rollback");
 }
 




More information about the bind10-changes mailing list