From: Michal 'vorner' Vaner Date: Thu, 2 Feb 2012 13:19:29 +0000 (+0100) Subject: [1595] Use share same application X-Git-Tag: trac2351_base~264^2~7 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e3f86da049a7af0ddb0369db2e9db3fa0903d3c5;p=thirdparty%2Fkea.git [1595] Use share same application Instead of don't share ‒ we configure the application name, so it should work. --- diff --git a/src/lib/server_common/portconfig.cc b/src/lib/server_common/portconfig.cc index 58c5cb63f4..d1e97f3604 100644 --- a/src/lib/server_common/portconfig.cc +++ b/src/lib/server_common/portconfig.cc @@ -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); diff --git a/src/lib/testutils/socket_request.h b/src/lib/testutils/socket_request.h index e16b3ca48b..8795db31c4 100644 --- a/src/lib/testutils/socket_request.h +++ b/src/lib/testutils/socket_request.h @@ -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(port) + ":" +