1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:28:12 +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:
Andreas Kling 2019-02-14 16:03:37 +01:00
parent eb1c721ef3
commit 00319c248c

View file

@ -97,6 +97,9 @@ RetainPtr<Socket> LocalSocket::connect(const sockaddr* address, socklen_t addres
bool LocalSocket::can_read(SocketRole role) const
{
if (m_bound && is_listening())
return can_accept();
if (role == SocketRole::Accepted)
return !m_for_server.is_empty();
else