mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:18:12 +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
|
@ -9,6 +9,7 @@
|
|||
#include <Kernel/KResult.h>
|
||||
|
||||
enum class SocketRole { None, Listener, Accepted, Connected, Connecting };
|
||||
enum class ShouldBlock { No = 0, Yes = 1 };
|
||||
|
||||
class Socket : public Retainable<Socket> {
|
||||
public:
|
||||
|
@ -25,7 +26,7 @@ public:
|
|||
KResult listen(int backlog);
|
||||
|
||||
virtual KResult bind(const sockaddr*, socklen_t) = 0;
|
||||
virtual KResult connect(const sockaddr*, socklen_t) = 0;
|
||||
virtual KResult connect(const sockaddr*, socklen_t, ShouldBlock) = 0;
|
||||
virtual bool get_address(sockaddr*, socklen_t*) = 0;
|
||||
virtual bool is_local() const { return false; }
|
||||
virtual bool is_ipv4() const { return false; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue