1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:28:12 +00:00

Kernel: Delay moving accepted sockets to SetupState::Completed a bit

Make sure we don't move accepted sockets to the Completed setup state
until we've actually constructed a FileDescription for them.

This is important, since this state transition will trigger connect()
to unblock on the client side, and the client may try writing to the
socket right away.

This makes DNS lookups way more reliable since we don't just fail to
write() right after connect()ing to LookupServer sometimes. :^)
This commit is contained in:
Andreas Kling 2019-10-08 21:41:46 +02:00
parent 3aa27b5b0e
commit 9bb0374d7d
2 changed files with 3 additions and 1 deletions

View file

@ -65,7 +65,6 @@ RefPtr<Socket> Socket::accept()
auto client = m_pending.take_first();
ASSERT(!client->is_connected());
client->m_acceptor_pid = m_origin_pid;
client->set_setup_state(SetupState::Completed);
client->m_connected = true;
client->m_role = Role::Accepted;
return client;