event/ServerSocket: add AddFD() overload with AllocatedSocketAddress&&

This commit is contained in:
Max Kellermann 2018-10-30 20:44:56 +01:00
parent ce9f09c69a
commit a943f4063c
2 changed files with 15 additions and 0 deletions

View File

@ -288,6 +288,18 @@ ServerSocket::AddFD(UniqueSocketDescriptor fd)
s.SetFD(std::move(fd)); s.SetFD(std::move(fd));
} }
void
ServerSocket::AddFD(UniqueSocketDescriptor fd,
AllocatedSocketAddress &&address) noexcept
{
assert(fd.IsDefined());
assert(!address.IsNull());
assert(address.IsDefined());
OneServerSocket &s = AddAddress(std::move(address));
s.SetFD(std::move(fd));
}
#ifdef HAVE_TCP #ifdef HAVE_TCP
inline void inline void

View File

@ -108,6 +108,9 @@ public:
*/ */
void AddFD(UniqueSocketDescriptor fd); void AddFD(UniqueSocketDescriptor fd);
void AddFD(UniqueSocketDescriptor fd,
AllocatedSocketAddress &&address) noexcept;
bool IsEmpty() const noexcept { bool IsEmpty() const noexcept {
return sockets.empty(); return sockets.empty();
} }