Parcourir la source

[1595] Let portconfig rely on app name

Michal 'vorner' Vaner il y a 13 ans
Parent
commit
0e7c11723d

+ 1 - 1
src/bin/auth/tests/auth_srv_unittest.cc

@@ -71,7 +71,7 @@ protected:
         dnss_(ios_, NULL, NULL, NULL),
         server(true, xfrout),
         rrclass(RRClass::IN()),
-        sock_requestor_(dnss_, address_store_, 53210)
+        sock_requestor_(dnss_, address_store_, 53210, "")
     {
         server.setDNSService(dnss_);
         server.setXfrinSession(&notify_session);

+ 1 - 1
src/bin/auth/tests/config_unittest.cc

@@ -46,7 +46,7 @@ protected:
         dnss_(ios_, NULL, NULL, NULL),
         rrclass(RRClass::IN()),
         server(true, xfrout),
-        sock_requestor_(dnss_, address_store_, 53210)
+        sock_requestor_(dnss_, address_store_, 53210, "")
     {
         server.setDNSService(dnss_);
     }

+ 1 - 1
src/bin/resolver/tests/resolver_config_unittest.cc

@@ -85,7 +85,7 @@ protected:
     scoped_ptr<const RequestContext> request;
     ResolverConfig() :
         dnss(ios, NULL, NULL, NULL),
-        sock_requestor_(dnss, address_store_, 53210)
+        sock_requestor_(dnss, address_store_, 53210, "")
     {
         server.setDNSService(dnss);
     }

+ 2 - 4
src/lib/server_common/portconfig.cc

@@ -101,8 +101,7 @@ setAddresses(DNSService& service, const AddressList& addresses) {
         const SocketRequestor::SocketID
             tcp(socketRequestor().requestSocket(SocketRequestor::TCP,
                                                 address.first, address.second,
-                                                SocketRequestor::DONT_SHARE,
-                                                "dummy_app"));
+                                                SocketRequestor::DONT_SHARE));
         current_sockets.push_back(tcp.second);
         if (!test_mode) {
             service.addServerTCPFromFD(tcp.first, af);
@@ -110,8 +109,7 @@ setAddresses(DNSService& service, const AddressList& addresses) {
         const SocketRequestor::SocketID
             udp(socketRequestor().requestSocket(SocketRequestor::UDP,
                                                 address.first, address.second,
-                                                SocketRequestor::DONT_SHARE,
-                                                "dummy_app"));
+                                                SocketRequestor::DONT_SHARE));
         current_sockets.push_back(udp.second);
         if (!test_mode) {
             service.addServerUDPFromFD(udp.first, af);

+ 1 - 1
src/lib/server_common/tests/portconfig_unittest.cc

@@ -133,7 +133,7 @@ TEST_F(ParseAddresses, invalid) {
 struct InstallListenAddresses : public ::testing::Test {
     InstallListenAddresses() :
         dnss_(ios_, NULL, NULL, NULL),
-        sock_requestor_(dnss_, store_, 5288)
+        sock_requestor_(dnss_, store_, 5288, "")
     {
         valid_.push_back(AddressPair("127.0.0.1", 5288));
         valid_.push_back(AddressPair("::1", 5288));

+ 8 - 3
src/lib/testutils/socket_request.h

@@ -59,11 +59,15 @@ public:
     /// \param expect_port The port which is expected to be requested. If
     ///     the application requests a different port, it is considered
     ///     a failure.
+    /// \param expeted_app The share name for which all the requests should
+    ///     be made.
     TestSocketRequestor(asiodns::DNSService& dnss,
                         server_common::portconfig::AddressList& store,
-                        uint16_t expect_port) :
+                        uint16_t expect_port,
+                        const std::string& expected_app) :
         last_token_(0), break_rollback_(false), break_release_(false),
-        dnss_(dnss), store_(store), expect_port_(expect_port)
+        dnss_(dnss), store_(store), expect_port_(expect_port),
+        expected_app_(expected_app)
     {
         // Prepare the requestor (us) for the test
         server_common::initTestSocketRequestor(this);
@@ -170,7 +174,7 @@ public:
         const size_t number = ++ last_token_;
         EXPECT_EQ(expect_port_, port);
         EXPECT_EQ(DONT_SHARE, mode);
-        EXPECT_EQ("dummy_app", name);
+        EXPECT_EQ(expected_app_, name);
         const std::string token(proto + ":" + address + ":" +
                                 boost::lexical_cast<std::string>(port) + ":" +
                                 boost::lexical_cast<std::string>(number));
@@ -207,6 +211,7 @@ private:
     asiodns::DNSService& dnss_;
     server_common::portconfig::AddressList& store_;
     const uint16_t expect_port_;
+    const std::string expected_app_;
 };
 
 }