diff options
| author | Caleb Maclennan <caleb@alerque.com> | 2026-08-31 10:57:42 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-31 10:57:42 +0300 |
| commit | 535178a3f0e2cff59f4d59ee3a655bee263a5c90 (patch) | |
| tree | 22d97c928a8043fd7e4a89897b163ab3deba9591 /src/options.c | |
| parent | 84c2bb905bda5f1fc58195171c75723b5fec6e87 (diff) | |
| parent | a9a1e25fdec1faba0237a554027a0f717f132c51 (diff) | |
| download | luasocket-535178a3f0e2cff59f4d59ee3a655bee263a5c90.tar.gz luasocket-535178a3f0e2cff59f4d59ee3a655bee263a5c90.tar.bz2 luasocket-535178a3f0e2cff59f4d59ee3a655bee263a5c90.zip | |
Merge pull request #449 from Wires77/add_SO_EXCLUSIVEADDRUSE
Add option for SO_EXCLUSIVEADDRUSE in Windows
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 | { |
