MCPcopy Create free account
hub / github.com/Tencent/UnLua / opt_set_linger

Function opt_set_linger

Plugins/UnLuaExtensions/LuaSocket/Source/src/options.cpp:238–253  ·  view source on GitHub ↗

------------------------------------------------------*/

Source from the content-addressed store, hash-verified

236
237/*------------------------------------------------------*/
238int 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
255int opt_get_linger(lua_State *L, p_socket ps)
256{

Callers

nothing calls this directly

Calls 8

auxiliar_typeerrorFunction · 0.85
lua_typenameFunction · 0.85
lua_pushstringFunction · 0.85
lua_gettableFunction · 0.85
luaL_argerrorFunction · 0.85
lua_tobooleanFunction · 0.85
lua_isnumberFunction · 0.85
opt_setFunction · 0.85

Tested by

no test coverage detected