From b56a0c1b16f10ba6290b4decedbc424433972f46 Mon Sep 17 00:00:00 2001 From: Wires77 Date: Thu, 27 Feb 2025 15:40:35 -0600 Subject: feat(core): Add option for Windows SO_EXCLUSIVEADDRUSE --- src/options.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/options.c') diff --git a/src/options.c b/src/options.c index 9dea6bd..1c3eb1c 100644 --- a/src/options.c +++ b/src/options.c @@ -93,6 +93,26 @@ int opt_get_reuseaddr(lua_State *L, p_socket ps) return opt_getboolean(L, ps, SOL_SOCKET, SO_REUSEADDR); } +/*------------------------------------------------------*/ +/* enables reuse of local address */ +int opt_set_exclusiveaddruse(lua_State* L, p_socket ps) +{ +#ifndef SO_EXCLUSIVEADDRUSE + return luaL_error(L, "SO_EXCLUSIVEADDRUSE is not supported on this operating system"); +#else + return opt_setboolean(L, ps, SOL_SOCKET, SO_EXCLUSIVEADDRUSE); +#endif +} + +int opt_get_exclusiveaddruse(lua_State* L, p_socket ps) +{ +#ifndef SO_EXCLUSIVEADDRUSE + return luaL_error(L, "SO_EXCLUSIVEADDRUSE is not supported on this operating system"); +#else + return opt_getboolean(L, ps, SOL_SOCKET, SO_EXCLUSIVEADDRUSE); +#endif +} + /*------------------------------------------------------*/ /* enables reuse of local port */ int opt_set_reuseport(lua_State *L, p_socket ps) -- cgit v1.2.3-55-g6feb