mirror of
https://github.com/RGBCube/serenity
synced 2025-06-29 15:02:12 +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:
parent
4bfed6a5ed
commit
cda56f8049
4 changed files with 16 additions and 10 deletions
|
@ -136,21 +136,26 @@ void Inode::set_shared_vmobject(Memory::SharedInodeVMObject& vmobject)
|
|||
m_shared_vmobject = vmobject;
|
||||
}
|
||||
|
||||
RefPtr<LocalSocket> Inode::bound_socket() const
|
||||
{
|
||||
return m_bound_socket;
|
||||
}
|
||||
|
||||
bool Inode::bind_socket(LocalSocket& socket)
|
||||
{
|
||||
MutexLocker locker(m_inode_lock);
|
||||
if (m_socket)
|
||||
if (m_bound_socket)
|
||||
return false;
|
||||
m_socket = socket;
|
||||
m_bound_socket = socket;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Inode::unbind_socket()
|
||||
{
|
||||
MutexLocker locker(m_inode_lock);
|
||||
if (!m_socket)
|
||||
if (!m_bound_socket)
|
||||
return false;
|
||||
m_socket = nullptr;
|
||||
m_bound_socket = nullptr;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue