diff options
| author | Wires77 <Wires77@users.noreply.github.com> | 2025-02-27 15:40:35 -0600 |
|---|---|---|
| committer | Caleb Maclennan <caleb@alerque.com> | 2026-08-31 10:52:00 +0300 |
| commit | b56a0c1b16f10ba6290b4decedbc424433972f46 (patch) | |
| tree | 00218f594f1d7036ae6c73bb03f952632d08f0ad /src/options.c | |
| parent | e13de2013749961edaa126697f3290d3dca91823 (diff) | |
| download | luasocket-b56a0c1b16f10ba6290b4decedbc424433972f46.tar.gz luasocket-b56a0c1b16f10ba6290b4decedbc424433972f46.tar.bz2 luasocket-b56a0c1b16f10ba6290b4decedbc424433972f46.zip | |
feat(core): Add option for Windows SO_EXCLUSIVEADDRUSE
Diffstat (limited to 'src/options.c')
| -rw-r--r-- | src/options.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/options.c b/src/options.c index 9dea6bd..1c3eb1c 100644 --- a/src/options.c +++ b/src/options.c | |||
| @@ -94,6 +94,26 @@ int opt_get_reuseaddr(lua_State *L, p_socket ps) | |||
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | /*------------------------------------------------------*/ | 96 | /*------------------------------------------------------*/ |
| 97 | /* enables reuse of local address */ | ||
| 98 | int opt_set_exclusiveaddruse(lua_State* L, p_socket ps) | ||
| 99 | { | ||
| 100 | #ifndef SO_EXCLUSIVEADDRUSE | ||
| 101 | return luaL_error(L, "SO_EXCLUSIVEADDRUSE is not supported on this operating system"); | ||
| 102 | #else | ||
| 103 | return opt_setboolean(L, ps, SOL_SOCKET, SO_EXCLUSIVEADDRUSE); | ||
| 104 | #endif | ||
| 105 | } | ||
| 106 | |||
| 107 | int opt_get_exclusiveaddruse(lua_State* L, p_socket ps) | ||
| 108 | { | ||
| 109 | #ifndef SO_EXCLUSIVEADDRUSE | ||
| 110 | return luaL_error(L, "SO_EXCLUSIVEADDRUSE is not supported on this operating system"); | ||
| 111 | #else | ||
| 112 | return opt_getboolean(L, ps, SOL_SOCKET, SO_EXCLUSIVEADDRUSE); | ||
| 113 | #endif | ||
| 114 | } | ||
| 115 | |||
| 116 | /*------------------------------------------------------*/ | ||
| 97 | /* enables reuse of local port */ | 117 | /* enables reuse of local port */ |
| 98 | int opt_set_reuseport(lua_State *L, p_socket ps) | 118 | int opt_set_reuseport(lua_State *L, p_socket ps) |
| 99 | { | 119 | { |
