aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdam Harrison <adamdharrison@gmail.com>2024-07-23 19:16:11 -0400
committerAdam Harrison <adamdharrison@gmail.com>2024-07-23 19:16:11 -0400
commit148b3be1afb13632d13bc7054acf56eee5e19f1c (patch)
tree4a01fdc95a9c1e70aa388e6499eecf008da62172 /src
parentbef2b5ce4a969e436ca1d266ca47fc22a6c241ea (diff)
downloadlite-xl-plugin-manager-148b3be1afb13632d13bc7054acf56eee5e19f1c.tar.gz
lite-xl-plugin-manager-148b3be1afb13632d13bc7054acf56eee5e19f1c.zip
Fixed windows non-blocking.
Diffstat (limited to 'src')
-rw-r--r--src/lpm.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/lpm.c b/src/lpm.c
index afc2948..5828803 100644
--- a/src/lpm.c
+++ b/src/lpm.c
@@ -1516,8 +1516,14 @@ static int lpm_get(lua_State* L) {
if (!host)
return luaL_error(L, "can't resolve hostname %s", context->hostname);
context->s = socket(AF_INET, SOCK_STREAM, 0);
- if (threaded)
- fcntl(context->s, F_SETFL, fcntl(context->s, F_GETFL, 0) | O_NONBLOCK);
+ if (threaded) {
+ #if _WIN32
+ unsigned long ul = 1;
+ ioctlsocket(context->s, FIONBIO, (unsigned long *) &ul);
+ #else
+ fcntl(context->s, F_SETFL, fcntl(context->s, F_GETFL, 0) | O_NONBLOCK);
+ #endif
+ }
dest_addr.sin_family = AF_INET;
dest_addr.sin_port = htons(port);
dest_addr.sin_addr.s_addr = *(long*)(host->h_addr);