1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:37:35 +00:00

Kernel: Fix race between accept() and connect().

We had a bug where an accepted socket would appear to be EOF/disconnected
on the accepting side until the connecting side had called attach_fd().

Fix this by adding a new SocketRole::Connecting state.
This commit is contained in:
Andreas Kling 2019-03-20 02:33:51 +01:00
parent 31d3616027
commit 4aa0ab4e08
5 changed files with 14 additions and 4 deletions

View file

@ -32,6 +32,7 @@ private:
bool m_bound { false };
int m_accepted_fds_open { 0 };
int m_connected_fds_open { 0 };
int m_connecting_fds_open { 0 };
sockaddr_un m_address;
DoubleBuffer m_for_client;