BIND 10 trac805, updated. d93776a7695e631375165090e001bcbe38923d7e [805] suggested minor changes: newline for readability; constify; distinguish false and NULL; typo

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Jan 4 04:49:10 UTC 2012


The branch, trac805 has been updated
       via  d93776a7695e631375165090e001bcbe38923d7e (commit)
       via  d66d5fea076e4174323aa0920dc91eb09c680674 (commit)
      from  cd0841fa5d7671f14baadaeb4e0177868caf21bc (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 d93776a7695e631375165090e001bcbe38923d7e
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Tue Jan 3 20:48:18 2012 -0800

    [805] suggested minor changes: newline for readability; constify; distinguish
    false and NULL; typo

commit d66d5fea076e4174323aa0920dc91eb09c680674
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Tue Jan 3 20:47:08 2012 -0800

    [805] updated the comments for listenAddresses() so that they match
    what the function actually does.  The previous one was incorrect and just
    confusing.

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

Summary of changes:
 src/lib/server_common/portconfig.cc                |    2 +-
 src/lib/server_common/tests/portconfig_unittest.cc |    7 ++++---
 src/lib/testutils/portconfig.h                     |    5 +++--
 src/lib/testutils/socket_request.h                 |   19 ++++++++++++++-----
 4 files changed, 22 insertions(+), 11 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/server_common/portconfig.cc b/src/lib/server_common/portconfig.cc
index 589db60..4201157 100644
--- a/src/lib/server_common/portconfig.cc
+++ b/src/lib/server_common/portconfig.cc
@@ -92,7 +92,7 @@ setAddresses(DNSService& service, const AddressList& addresses) {
     }
     current_sockets.clear();
     BOOST_FOREACH(const AddressPair &address, addresses) {
-        int af(IOAddress(address.first).getFamily());
+        const int af(IOAddress(address.first).getFamily());
         // TODO: Support sharing somehow in future.
         const SocketRequestor::SocketID
             tcp(socketRequestor().requestSocket(SocketRequestor::TCP,
diff --git a/src/lib/server_common/tests/portconfig_unittest.cc b/src/lib/server_common/tests/portconfig_unittest.cc
index 9e6ad46..4507e14 100644
--- a/src/lib/server_common/tests/portconfig_unittest.cc
+++ b/src/lib/server_common/tests/portconfig_unittest.cc
@@ -148,12 +148,13 @@ struct InstallListenAddresses : public testutils::TestSocketRequestor {
     // But this shouldn't work
     AddressList invalid_;
     // Check that the store_ addresses are the same as expected
-    void checkAddresses(const AddressList& expected, const string& name) {
+    void checkAddresses(const AddressList& expected, const string& name) const
+    {
         SCOPED_TRACE(name);
 
         ASSERT_EQ(expected.size(), store_.size()) <<
             "Different amount of elements, not checking content";
-        // Run in parallel trough the vectors
+        // Run in parallel through the vectors
         for (AddressList::const_iterator ei(expected.begin()),
              si(store_.begin()); ei != expected.end(); ++ei, ++si) {
             EXPECT_EQ(ei->first, si->first);
@@ -244,7 +245,7 @@ TEST_F(InstallListenAddresses, rollback) {
     checkTokens(released1, released_tokens_, "Released after rollback");
 }
 
-// Try it at last returns everything when even the rollback fails.
+// Try it at least returns everything when even the rollback fails.
 TEST_F(InstallListenAddresses, brokenRollback) {
     EXPECT_NO_THROW(installListenAddresses(valid_, store_, dnss_));
     checkAddresses(valid_, "Before rollback");
diff --git a/src/lib/testutils/portconfig.h b/src/lib/testutils/portconfig.h
index a4dc2bd..b538478 100644
--- a/src/lib/testutils/portconfig.h
+++ b/src/lib/testutils/portconfig.h
@@ -46,7 +46,7 @@ template<class Server>
 void
 listenAddresses(Server& server) {
     using namespace isc::server_common::portconfig;
-    // Default value should be fully recursive
+    // In this test we assume the address list is originally empty.
     EXPECT_TRUE(server.getListenAddresses().empty());
 
     // Try putting there some addresses
@@ -61,7 +61,8 @@ listenAddresses(Server& server) {
     addresses.clear();
     EXPECT_EQ(2, server.getListenAddresses().size());
 
-    // Did it return to fully recursive?
+    // If we set to an empty list next, the server configuration should
+    // become empty, too.
     server.setListenAddresses(addresses);
     EXPECT_TRUE(server.getListenAddresses().empty());
 }
diff --git a/src/lib/testutils/socket_request.h b/src/lib/testutils/socket_request.h
index 0ca741f..8a820f0 100644
--- a/src/lib/testutils/socket_request.h
+++ b/src/lib/testutils/socket_request.h
@@ -72,12 +72,15 @@ protected:
         last_token_(0), break_rollback_(false), dnss_(dnss), store_(store),
         expect_port_(expect_port)
     {}
+
     /// \brief Destructor
     virtual ~ TestSocketRequestor() {}
+
     /// \brief Tokens released by releaseSocket
     ///
     /// They are stored here by this class and you can examine them.
     std::vector<std::string> released_tokens_;
+
     /// \brief Tokens returned from requestSocket
     ///
     /// They are stored here by this class and you can examine them.
@@ -91,6 +94,7 @@ protected:
     /// If this is set to true, the requestSocket will throw when the
     /// ::1 address is requested.
     bool break_rollback_;
+
     /// \brief Release a socket
     ///
     /// This only stores the token passed.
@@ -98,9 +102,10 @@ protected:
     void releaseSocket(const std::string& token) {
         released_tokens_.push_back(token);
     }
+
     /// \brief Request a socket
     ///
-    /// This creates a new token and fakes a new socket and returs it.
+    /// This creates a new token and fakes a new socket and returns it.
     /// The token is stored.
     ///
     /// In case the address is 192.0.2.2 or if the break_rollback_ is true
@@ -133,7 +138,7 @@ protected:
                       "This address is available, but not for you");
         }
         const std::string proto(protocol == TCP ? "TCP" : "UDP");
-        size_t number = ++ last_token_;
+        const size_t number = ++ last_token_;
         EXPECT_EQ(expect_port_, port);
         EXPECT_EQ(DONT_SHARE, mode);
         EXPECT_EQ("dummy_app", name);
@@ -143,6 +148,7 @@ protected:
         given_tokens_.push_back(token);
         return (SocketID(number, token));
     }
+
     /// \brief Initialize the test
     ///
     /// It installs itself as the socket requestor. It also turns on portconfig
@@ -156,6 +162,7 @@ protected:
         // Don't manipulate the real sockets
         server_common::portconfig::test_mode = true;
     }
+
     /// \brief Cleanup after the test
     ///
     /// Removes the addresses (if any) installed by installListenAddresses,
@@ -173,6 +180,7 @@ protected:
         // And return the mode
         server_common::portconfig::test_mode = false;
     }
+
     /// \brief Check the list of tokens is as expected
     ///
     /// Compares the expected and real tokens.
@@ -186,21 +194,22 @@ protected:
     ///     It is printed as a part of failure message.
     void checkTokens(const char** expected,
                      const std::vector<std::string>& real,
-                     const char* scope)
+                     const char* scope) const
     {
         SCOPED_TRACE(scope);
         size_t position(0);
-        while (expected[position]) {
+        while (expected[position] != NULL) {
             ASSERT_LT(position, real.size());
             EXPECT_EQ(expected[position], real[position]) << position;
             position ++;
         }
         EXPECT_EQ(position, real.size());
     }
+
 private:
     asiodns::DNSService& dnss_;
     server_common::portconfig::AddressList& store_;
-    uint16_t expect_port_;
+    const uint16_t expect_port_;
 };
 
 }




More information about the bind10-changes mailing list