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

Function meth_shutdown

Plugins/UnLuaExtensions/LuaSocket/Source/src/unixstream.cpp:309–318  ·  view source on GitHub ↗

-------------------------------------------------------------------------*\ * Shuts the connection down partially \*-------------------------------------------------------------------------*/

Source from the content-addressed store, hash-verified

307* Shuts the connection down partially
308\*-------------------------------------------------------------------------*/
309static int meth_shutdown(lua_State *L)
310{
311 /* SHUT_RD, SHUT_WR, SHUT_RDWR have the value 0, 1, 2, so we can use method index directly */
312 static const char* methods[] = { "receive", "send", "both", NULL };
313 p_unix stream = (p_unix) auxiliar_checkclass(L, "unixstream{client}", 1);
314 int how = luaL_checkoption(L, 2, "both", methods);
315 socket_shutdown(&stream->sock, how);
316 lua_pushnumber(L, 1);
317 return 1;
318}
319
320/*-------------------------------------------------------------------------*\
321* Just call tm methods

Callers

nothing calls this directly

Calls 4

auxiliar_checkclassFunction · 0.85
luaL_checkoptionFunction · 0.85
lua_pushnumberFunction · 0.85
socket_shutdownFunction · 0.70

Tested by

no test coverage detected