Commit e3f86da0 authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

[1595] Use share same application

Instead of don't share ‒ we configure the application name, so it should
work.
parent 0e7c1172
......@@ -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);
......
......@@ -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) + ":" +
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment