Parcourir la source

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.
Andreas Kling il y a 6 ans
Parent
commit
00319c248c
1 fichiers modifiés avec 3 ajouts et 0 suppressions
  1. 3 0
      Kernel/LocalSocket.cpp

+ 3 - 0
Kernel/LocalSocket.cpp

@@ -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