1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:08:13 +00:00

Kernel: Robustify and rename Inode bound socket API

Rename the bound socket accessor from socket() to bound_socket().
Also return RefPtr<LocalSocket> instead of a raw pointer, to make it
harder for callers to mess up.
This commit is contained in:
Andreas Kling 2022-02-07 12:57:57 +01:00
parent 4bfed6a5ed
commit cda56f8049
4 changed files with 16 additions and 10 deletions

View file

@ -174,7 +174,9 @@ ErrorOr<void> LocalSocket::connect(OpenFileDescription& description, Userspace<c
m_inode = inode;
VERIFY(inode);
if (!inode->socket())
auto peer = inode->bound_socket();
if (!peer)
return set_so_error(ECONNREFUSED);
m_path = move(path);
@ -182,7 +184,6 @@ ErrorOr<void> LocalSocket::connect(OpenFileDescription& description, Userspace<c
VERIFY(m_connect_side_fd == &description);
set_connect_side_role(Role::Connecting);
auto peer = file->inode()->socket();
auto result = peer->queue_connection_from(*this);
if (result.is_error()) {
set_connect_side_role(Role::None);