mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-05 08:06:09 +00:00
Kernel: Add a new block state for accept() on a blocking socket
Rather than asserting, which really ruins everyone's day.
This commit is contained in:
committed by
Andreas Kling
parent
79a6312c8f
commit
f2fdac789c
@@ -2120,8 +2120,13 @@ int Process::sys$accept(int accepting_socket_fd, sockaddr* address, socklen_t* a
|
||||
return -ENOTSOCK;
|
||||
auto& socket = *accepting_socket_description->socket();
|
||||
if (!socket.can_accept()) {
|
||||
ASSERT(!accepting_socket_description->is_blocking());
|
||||
return -EAGAIN;
|
||||
if (accepting_socket_description->is_blocking()) {
|
||||
current->block(Thread::State::BlockedAccept, *accepting_socket_description);
|
||||
if (current->m_was_interrupted_while_blocked)
|
||||
return -EINTR;
|
||||
} else {
|
||||
return -EAGAIN;
|
||||
}
|
||||
}
|
||||
auto accepted_socket = socket.accept();
|
||||
ASSERT(accepted_socket);
|
||||
|
||||
Reference in New Issue
Block a user