summaryrefslogtreecommitdiff
path: root/Kernel/Net/Socket.h
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-04-08 04:52:21 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-04-08 04:52:21 +0200
commit65d6318c33ca6f3d6f26ab47c6144e5489d614bb (patch)
tree519b7660083cc2bee70b2449f485ee1a55dcff78 /Kernel/Net/Socket.h
parent7fcca0ce4b776637100f5dc1da8fda4e91668730 (diff)
downloadserenity-65d6318c33ca6f3d6f26ab47c6144e5489d614bb.zip
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.
Diffstat (limited to 'Kernel/Net/Socket.h')
-rw-r--r--Kernel/Net/Socket.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/Kernel/Net/Socket.h b/Kernel/Net/Socket.h
index 683ff53858..b0c946ab51 100644
--- a/Kernel/Net/Socket.h
+++ b/Kernel/Net/Socket.h
@@ -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; }