mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:07:45 +00:00
Kernel: Let's say that listening+bound sockets "can read."
This will make it easy-peasy to select() on a socket file descriptor to wait for incoming connections together with other activities.
This commit is contained in:
parent
eb1c721ef3
commit
00319c248c
1 changed files with 3 additions and 0 deletions
|
@ -97,6 +97,9 @@ RetainPtr<Socket> LocalSocket::connect(const sockaddr* address, socklen_t addres
|
||||||
|
|
||||||
bool LocalSocket::can_read(SocketRole role) const
|
bool LocalSocket::can_read(SocketRole role) const
|
||||||
{
|
{
|
||||||
|
if (m_bound && is_listening())
|
||||||
|
return can_accept();
|
||||||
|
|
||||||
if (role == SocketRole::Accepted)
|
if (role == SocketRole::Accepted)
|
||||||
return !m_for_server.is_empty();
|
return !m_for_server.is_empty();
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue