mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-13 04:21:54 +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:
parent
31d3616027
commit
4aa0ab4e08
Notes:
sideshowbarker
2024-07-19 14:59:59 +09:00
Author: https://github.com/awesomekling
Commit: 4aa0ab4e08
5 changed files with 14 additions and 4 deletions
|
@ -76,8 +76,11 @@ void FileDescriptor::set_socket_role(SocketRole role)
|
|||
return;
|
||||
|
||||
ASSERT(m_socket);
|
||||
auto old_socket_role = m_socket_role;
|
||||
m_socket_role = role;
|
||||
m_socket->attach_fd(role);
|
||||
if (old_socket_role != SocketRole::None)
|
||||
m_socket->detach_fd(old_socket_role);
|
||||
}
|
||||
|
||||
Retained<FileDescriptor> FileDescriptor::clone()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue