Skip to content

Commit 61c4625

Browse files
committed
windows fixes
1 parent 2876c91 commit 61c4625

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

ljsocket.lua

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,7 @@ do
849849
e.SO_SNDTIMEO = 4101
850850
e.POLLIN = 768
851851
e.POLLPRI = 1024
852+
e.POLLOUT = 16
852853
e.SO_TYPE = 4104
853854
e.POLLRDBAND = 512
854855
e.POLLWRBAND = 32
@@ -1245,6 +1246,12 @@ do
12451246
function meta:set_option(key, val, level)
12461247
level = level or "socket"
12471248

1249+
-- Windows doesn't support SO_BROADCAST on SOCK_STREAM sockets
1250+
if ffi.os == "Windows" and key:lower() == "broadcast" and self.socket_type == "stream" then
1251+
-- Silently succeed for compatibility
1252+
return true
1253+
end
1254+
12481255
if key:lower() == "rcvtimeo" then
12491256
if ffi.os == "Windows" then
12501257
val = ffi.new("int[1]", val)
@@ -1279,6 +1286,12 @@ do
12791286
function meta:get_option(key, level)
12801287
level = level or "socket"
12811288

1289+
-- Windows doesn't support SO_BROADCAST on SOCK_STREAM sockets
1290+
if ffi.os == "Windows" and key:lower() == "broadcast" and self.socket_type == "stream" then
1291+
-- Return 0 (disabled) for compatibility
1292+
return 0
1293+
end
1294+
12821295
local env = SO
12831296

12841297
if level == "tcp" then env = TCP end

ljtls.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ local loaders = {
164164
"Microsoft Unified Security Protocol Provider",
165165
SECPKG_CRED_OUTBOUND,
166166
nil,
167-
nil,
167+
ffi.cast("void*", nil),
168168
nil,
169169
nil,
170170
hCreds,

0 commit comments

Comments
 (0)