mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 11:20:03 +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:
@@ -2503,6 +2503,7 @@ int Process::sys$connect(int sockfd, const sockaddr* address, socklen_t address_
|
||||
if (!descriptor->is_socket())
|
||||
return -ENOTSOCK;
|
||||
auto& socket = *descriptor->socket();
|
||||
descriptor->set_socket_role(SocketRole::Connecting);
|
||||
auto result = socket.connect(address, address_size);
|
||||
if (result.is_error())
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user