From bc22593d2544327b18fbecd57dbcac0bc7c7ca25 Mon Sep 17 00:00:00 2001 From: Kubat <mael.martin31@gmail.com> Date: Wed, 1 Dec 2021 22:03:17 +0100 Subject: [PATCH] MISC: Correct lkt_state struct for windows and forbit the UNIX socket on windows (not supported) --- inc/lektor/net.h | 9 ++++++--- src/net/listen.c | 6 +++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/inc/lektor/net.h b/inc/lektor/net.h index 7a08be58..22fe26e6 100644 --- a/inc/lektor/net.h +++ b/inc/lektor/net.h @@ -55,15 +55,18 @@ int lkt_message_send(SOCKET fd, const struct lkt_message *const msg); struct lkt_state { #if defined(LKT_OS_WIN) && (LKT_OS_WIN == 1) /* The FDS, Windob' version */ - fd_set *fds; + LPWSAPOLLFD fds; + ULONG fds_len; + ULONG fds_max; + #else /* The FDS, toaster OS version */ struct pollfd *fds; + size_t fds_len; + size_t fds_max; #endif struct lkt_client *clients; - size_t fds_len; - size_t fds_max; char host[HOST_NAME_MAX]; char port[LKT_LINE_MAX]; struct queue queue; diff --git a/src/net/listen.c b/src/net/listen.c index 92e64210..38ba57a6 100644 --- a/src/net/listen.c +++ b/src/net/listen.c @@ -1110,7 +1110,11 @@ lkt_listen(struct lkt_state *srv) #endif LOG_INFO("INIT", "Signal handlers registered"); - int is_unix_socket = STR_NMATCH(srv->port, "unix", 4); +#if !(defined(LKT_OS_WIN) && (LKT_OS_WIN == 1)) + const int is_unix_socket = STR_NMATCH(srv->port, "unix", 4); +#else + const int is_unix_socket = false; +#endif unsigned int perms = 0600; /* FIXME: Use the server register, and add a socket type (which is -- GitLab