event/ServerSocket: make OneServerSocket an inner class
This commit is contained in:
parent
0307b49f43
commit
c6f61a699c
@ -52,7 +52,7 @@
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
|
||||
class OneServerSocket final : private SocketMonitor {
|
||||
class ServerSocket::OneServerSocket final : private SocketMonitor {
|
||||
ServerSocket &parent;
|
||||
|
||||
const unsigned serial;
|
||||
@ -146,7 +146,7 @@ get_remote_uid(int fd)
|
||||
}
|
||||
|
||||
inline void
|
||||
OneServerSocket::Accept() noexcept
|
||||
ServerSocket::OneServerSocket::Accept() noexcept
|
||||
{
|
||||
StaticSocketAddress peer_address;
|
||||
UniqueSocketDescriptor peer_fd(GetSocket().AcceptNonBlock(peer_address));
|
||||
@ -170,14 +170,14 @@ OneServerSocket::Accept() noexcept
|
||||
}
|
||||
|
||||
bool
|
||||
OneServerSocket::OnSocketReady(gcc_unused unsigned flags) noexcept
|
||||
ServerSocket::OneServerSocket::OnSocketReady(gcc_unused unsigned flags) noexcept
|
||||
{
|
||||
Accept();
|
||||
return true;
|
||||
}
|
||||
|
||||
inline void
|
||||
OneServerSocket::Open()
|
||||
ServerSocket::OneServerSocket::Open()
|
||||
{
|
||||
assert(!IsDefined());
|
||||
|
||||
@ -272,7 +272,7 @@ ServerSocket::Close() noexcept
|
||||
i.Close();
|
||||
}
|
||||
|
||||
OneServerSocket &
|
||||
ServerSocket::OneServerSocket &
|
||||
ServerSocket::AddAddress(SocketAddress address) noexcept
|
||||
{
|
||||
sockets.emplace_back(loop, *this, next_serial,
|
||||
@ -281,7 +281,7 @@ ServerSocket::AddAddress(SocketAddress address) noexcept
|
||||
return sockets.back();
|
||||
}
|
||||
|
||||
OneServerSocket &
|
||||
ServerSocket::OneServerSocket &
|
||||
ServerSocket::AddAddress(AllocatedSocketAddress &&address) noexcept
|
||||
{
|
||||
sockets.emplace_back(loop, *this, next_serial,
|
||||
|
@ -27,13 +27,12 @@ class AllocatedSocketAddress;
|
||||
class UniqueSocketDescriptor;
|
||||
class EventLoop;
|
||||
class AllocatedPath;
|
||||
class OneServerSocket;
|
||||
|
||||
/**
|
||||
* A socket that accepts incoming stream connections (e.g. TCP).
|
||||
*/
|
||||
class ServerSocket {
|
||||
friend class OneServerSocket;
|
||||
class OneServerSocket;
|
||||
|
||||
EventLoop &loop;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user