Commit ce9f09c6 authored by Max Kellermann's avatar Max Kellermann

event/ServerSocket: make AddAddress() a template

parent 3ddc7a53
...@@ -265,20 +265,12 @@ ServerSocket::Close() noexcept ...@@ -265,20 +265,12 @@ ServerSocket::Close() noexcept
i.Close(); i.Close();
} }
template<typename A>
ServerSocket::OneServerSocket & ServerSocket::OneServerSocket &
ServerSocket::AddAddress(SocketAddress address) noexcept ServerSocket::AddAddress(A &&address) noexcept
{ {
sockets.emplace_back(loop, *this, next_serial, sockets.emplace_back(loop, *this, next_serial,
address); std::forward<A>(address));
return sockets.back();
}
ServerSocket::OneServerSocket &
ServerSocket::AddAddress(AllocatedSocketAddress &&address) noexcept
{
sockets.emplace_back(loop, *this, next_serial,
std::move(address));
return sockets.back(); return sockets.back();
} }
......
...@@ -49,8 +49,8 @@ public: ...@@ -49,8 +49,8 @@ public:
} }
private: private:
OneServerSocket &AddAddress(SocketAddress address) noexcept; template<typename A>
OneServerSocket &AddAddress(AllocatedSocketAddress &&address) noexcept; OneServerSocket &AddAddress(A &&address) noexcept;
/** /**
* Add a listener on a port on all IPv4 interfaces. * Add a listener on a port on all IPv4 interfaces.
......
Markdown is supported
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