1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-10 09:37:34 +00:00

Kernel: Add Socket::set_role() and use it everywhere

Instead of having Socket subclasses write their role into Socket::m_role
directly, add a setter to do this.
This commit is contained in:
Andreas Kling 2021-08-29 02:04:30 +02:00
parent 70b2225b3d
commit a28cd921a1
6 changed files with 10 additions and 8 deletions

View file

@ -66,7 +66,7 @@ KResultOr<SocketPair> LocalSocket::try_create_connected_pair(int type)
socket->set_acceptor(Process::current());
socket->set_connected(true);
socket->set_connect_side_role(Role::Connected);
socket->m_role = Role::Accepted;
socket->set_role(Role::Accepted);
auto description2_result = FileDescription::try_create(*socket);
if (description2_result.is_error())
@ -243,7 +243,7 @@ KResult LocalSocket::listen(size_t backlog)
return set_so_error(EOPNOTSUPP);
set_backlog(backlog);
auto previous_role = m_role;
m_role = Role::Listener;
set_role(Role::Listener);
set_connect_side_role(Role::Listener, previous_role != m_role);
dbgln_if(LOCAL_SOCKET_DEBUG, "LocalSocket({}) listening with backlog={}", this, backlog);