mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:08:13 +00:00
Kernel: Support non-blocking connect().
If connect() is called on a non-blocking socket, it will "fail" immediately with -EINPROGRESS. After that, you select() on the socket and wait for it to become writable.
This commit is contained in:
parent
7fcca0ce4b
commit
65d6318c33
11 changed files with 22 additions and 17 deletions
|
@ -2038,7 +2038,7 @@ int Process::sys$connect(int sockfd, const sockaddr* address, socklen_t address_
|
|||
return -EISCONN;
|
||||
auto& socket = *descriptor->socket();
|
||||
descriptor->set_socket_role(SocketRole::Connecting);
|
||||
auto result = socket.connect(address, address_size);
|
||||
auto result = socket.connect(address, address_size, descriptor->is_blocking() ? ShouldBlock::Yes : ShouldBlock::No);
|
||||
if (result.is_error()) {
|
||||
descriptor->set_socket_role(SocketRole::None);
|
||||
return result;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue