diff options
author | Max Kellermann <max@musicpd.org> | 2018-10-30 20:44:56 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-10-30 20:44:56 +0100 |
commit | a943f4063ca82ad348e53492fbf18df09f37952b (patch) | |
tree | 494d48795c7ae3d9666062a5e2ceb94ffd9c92ae /src/event | |
parent | ce9f09c69a2bba8068c72fd4bdaf5a01fd08e15f (diff) |
event/ServerSocket: add AddFD() overload with AllocatedSocketAddress&&
Diffstat (limited to 'src/event')
-rw-r--r-- | src/event/ServerSocket.cxx | 12 | ||||
-rw-r--r-- | src/event/ServerSocket.hxx | 3 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/event/ServerSocket.cxx b/src/event/ServerSocket.cxx index d3abb124a..cf51cb363 100644 --- a/src/event/ServerSocket.cxx +++ b/src/event/ServerSocket.cxx @@ -288,6 +288,18 @@ ServerSocket::AddFD(UniqueSocketDescriptor 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 inline void diff --git a/src/event/ServerSocket.hxx b/src/event/ServerSocket.hxx index 3cb0ad422..5b0d81cdd 100644 --- a/src/event/ServerSocket.hxx +++ b/src/event/ServerSocket.hxx @@ -108,6 +108,9 @@ public: */ void AddFD(UniqueSocketDescriptor fd); + void AddFD(UniqueSocketDescriptor fd, + AllocatedSocketAddress &&address) noexcept; + bool IsEmpty() const noexcept { return sockets.empty(); } |