]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[1595] Use share same application
authorMichal 'vorner' Vaner <michal.vaner@nic.cz>
Thu, 2 Feb 2012 13:19:29 +0000 (14:19 +0100)
committerMichal 'vorner' Vaner <michal.vaner@nic.cz>
Thu, 2 Feb 2012 13:19:29 +0000 (14:19 +0100)
Instead of don't share ‒ we configure the application name, so it should
work.

src/lib/server_common/portconfig.cc
src/lib/testutils/socket_request.h

index 58c5cb63f404bb934ef95ecbbec3228ccbd6252e..d1e97f3604fd13046daf6f2bfdfa0d6edc131aba 100644 (file)
@@ -92,16 +92,12 @@ setAddresses(DNSService& service, const AddressList& addresses) {
     current_sockets.clear();
     BOOST_FOREACH(const AddressPair &address, addresses) {
         const int af(IOAddress(address.first).getFamily());
-        // TODO: Support sharing somehow in future.
-
-        // As for now, we hardcode the application name as dummy_app, because:
-        // * we don't have a name available in our interface, which will change
-        //   soon anyway
-        // * we use the DONT_SHARE mode, so the name is irrelevant anyway
+        // We use the application name supplied to the socket requestor on
+        // creation. So we can freely use the SHARE_SAME
         const SocketRequestor::SocketID
             tcp(socketRequestor().requestSocket(SocketRequestor::TCP,
                                                 address.first, address.second,
-                                                SocketRequestor::DONT_SHARE));
+                                                SocketRequestor::SHARE_SAME));
         current_sockets.push_back(tcp.second);
         if (!test_mode) {
             service.addServerTCPFromFD(tcp.first, af);
@@ -109,7 +105,7 @@ setAddresses(DNSService& service, const AddressList& addresses) {
         const SocketRequestor::SocketID
             udp(socketRequestor().requestSocket(SocketRequestor::UDP,
                                                 address.first, address.second,
-                                                SocketRequestor::DONT_SHARE));
+                                                SocketRequestor::SHARE_SAME));
         current_sockets.push_back(udp.second);
         if (!test_mode) {
             service.addServerUDPFromFD(udp.first, af);
index e16b3ca48bc677d8297b543e7ef0c6621ae8327e..8795db31c42143e999a0b812f7883cfe73b48938 100644 (file)
@@ -145,8 +145,9 @@ public:
     /// \param protocol The protocol to request
     /// \param address to bind to
     /// \param port to bind to
-    /// \param mode checked to be DONT_SHARE for now
-    /// \param name checked to be dummy_app for now
+    /// \param mode checked to be SHARE_SAME for now
+    /// \param name checked to be the same as expected_app parameter of the
+    ///      constructor
     /// \return The token and FD
     /// \throw SocketAllocateError as described above, to test error handling
     /// \throw ShareError as described above, to test error handling
@@ -173,7 +174,7 @@ public:
         const std::string proto(protocol == TCP ? "TCP" : "UDP");
         const size_t number = ++ last_token_;
         EXPECT_EQ(expect_port_, port);
-        EXPECT_EQ(DONT_SHARE, mode);
+        EXPECT_EQ(SHARE_SAME, mode);
         EXPECT_EQ(expected_app_, name);
         const std::string token(proto + ":" + address + ":" +
                                 boost::lexical_cast<std::string>(port) + ":" +