Networking: support nowait connection (Posix)

Thread was used for now.
It's possible to do nonblocking connect & send with io_uring on Linux, but it requires newer kernel and linking to liburing. I don't think it is worth the effort.
This commit is contained in:
李通洲
2022-11-02 17:29:43 +08:00
parent 46ebb52afa
commit 9da7bb3f30
2 changed files with 56 additions and 23 deletions
+10 -3
View File
@@ -3,6 +3,7 @@
#ifndef FF_INCLUDED_common_networking
#define FF_INCLUDED_common_networking
#include "common/thread.h"
#include "util/FFstrbuf.h"
#ifdef _WIN32
@@ -11,10 +12,16 @@
typedef struct FFNetworkingState {
#ifdef _WIN32
uintptr_t sockfd;
OVERLAPPED overlapped;
uintptr_t sockfd;
OVERLAPPED overlapped;
#else
int sockfd;
int sockfd;
FFstrbuf host;
FFstrbuf command;
#ifdef FF_HAVE_THREADS
FFThreadType thread;
#endif
#endif
} FFNetworkingState;