Added getstats.
This commit is contained in:
parent
2562738e2d
commit
63807d6476
7 changed files with 31 additions and 7 deletions
13
src/tcp.c
13
src/tcp.c
|
@ -23,6 +23,7 @@ static int meth_connect(lua_State *L);
|
|||
static int meth_listen(lua_State *L);
|
||||
static int meth_bind(lua_State *L);
|
||||
static int meth_send(lua_State *L);
|
||||
static int meth_getstats(lua_State *L);
|
||||
static int meth_getsockname(lua_State *L);
|
||||
static int meth_getpeername(lua_State *L);
|
||||
static int meth_shutdown(lua_State *L);
|
||||
|
@ -47,6 +48,7 @@ static luaL_reg tcp[] = {
|
|||
{"getfd", meth_getfd},
|
||||
{"getpeername", meth_getpeername},
|
||||
{"getsockname", meth_getsockname},
|
||||
{"getstats", meth_getstats},
|
||||
{"listen", meth_listen},
|
||||
{"receive", meth_receive},
|
||||
{"send", meth_send},
|
||||
|
@ -100,18 +102,21 @@ int tcp_open(lua_State *L)
|
|||
/*-------------------------------------------------------------------------*\
|
||||
* Just call buffered IO methods
|
||||
\*-------------------------------------------------------------------------*/
|
||||
static int meth_send(lua_State *L)
|
||||
{
|
||||
static int meth_send(lua_State *L) {
|
||||
p_tcp tcp = (p_tcp) aux_checkclass(L, "tcp{client}", 1);
|
||||
return buf_meth_send(L, &tcp->buf);
|
||||
}
|
||||
|
||||
static int meth_receive(lua_State *L)
|
||||
{
|
||||
static int meth_receive(lua_State *L) {
|
||||
p_tcp tcp = (p_tcp) aux_checkclass(L, "tcp{client}", 1);
|
||||
return buf_meth_receive(L, &tcp->buf);
|
||||
}
|
||||
|
||||
static int meth_getstats(lua_State *L) {
|
||||
p_tcp tcp = (p_tcp) aux_checkgroup(L, "tcp{any}", 1);
|
||||
return buf_meth_getstats(L, &tcp->buf);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*\
|
||||
* Just call option handler
|
||||
\*-------------------------------------------------------------------------*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue