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

Function meth_shutdown

Plugins/UnLuaExtensions/LuaSocket/Source/src/tcp.cpp:340–349  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

338* Shuts the connection down partially
339\*-------------------------------------------------------------------------*/
340static int meth_shutdown(lua_State *L)
341{
342 /* SHUT_RD, SHUT_WR, SHUT_RDWR have the value 0, 1, 2, so we can use method index directly */
343 static const char* methods[] = { "receive", "send", "both", NULL };
344 p_tcp tcp = (p_tcp) auxiliar_checkclass(L, "tcp{client}", 1);
345 int how = luaL_checkoption(L, 2, "both", methods);
346 socket_shutdown(&tcp->sock, how);
347 lua_pushnumber(L, 1);
348 return 1;
349}
350
351/*-------------------------------------------------------------------------*\
352* Just call inet 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