------------------------------------------------------*/
| 236 | |
| 237 | /*------------------------------------------------------*/ |
| 238 | int opt_set_linger(lua_State *L, p_socket ps) |
| 239 | { |
| 240 | struct linger li; /* obj, name, table */ |
| 241 | if (!lua_istable(L, 3)) auxiliar_typeerror(L,3,lua_typename(L, LUA_TTABLE)); |
| 242 | lua_pushstring(L, "on"); |
| 243 | lua_gettable(L, 3); |
| 244 | if (!lua_isboolean(L, -1)) |
| 245 | luaL_argerror(L, 3, "boolean 'on' field expected"); |
| 246 | li.l_onoff = (u_short) lua_toboolean(L, -1); |
| 247 | lua_pushstring(L, "timeout"); |
| 248 | lua_gettable(L, 3); |
| 249 | if (!lua_isnumber(L, -1)) |
| 250 | luaL_argerror(L, 3, "number 'timeout' field expected"); |
| 251 | li.l_linger = (u_short) lua_tonumber(L, -1); |
| 252 | return opt_set(L, ps, SOL_SOCKET, SO_LINGER, (char *) &li, sizeof(li)); |
| 253 | } |
| 254 | |
| 255 | int opt_get_linger(lua_State *L, p_socket ps) |
| 256 | { |
nothing calls this directly
no test coverage detected