aboutsummaryrefslogtreecommitdiff
path: root/src/udp.c
diff options
context:
space:
mode:
authorDiego Nehab <diego.nehab@gmail.com>2016-03-04 15:36:32 -0300
committerDiego Nehab <diego.nehab@gmail.com>2016-03-04 15:36:32 -0300
commit944305dc21350fd2ec32a9552d893da86894fd62 (patch)
tree82948c24dade5e0da6924ab5e706f146bce4692a /src/udp.c
parentcdce73b226cc4da6a073b79bec02a6780d32ff1a (diff)
downloadluasocket-944305dc21350fd2ec32a9552d893da86894fd62.tar.gz
luasocket-944305dc21350fd2ec32a9552d893da86894fd62.tar.bz2
luasocket-944305dc21350fd2ec32a9552d893da86894fd62.zip
Added gettimeout for completeness.
Also documented. Rordered manuals so order is alphabetical.
Diffstat (limited to 'src/udp.c')
-rw-r--r--src/udp.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/udp.c b/src/udp.c
index 968dca8..ec97252 100644
--- a/src/udp.c
+++ b/src/udp.c
@@ -36,6 +36,7 @@ static int meth_receivefrom(lua_State *L);
36static int meth_getfamily(lua_State *L); 36static int meth_getfamily(lua_State *L);
37static int meth_getsockname(lua_State *L); 37static int meth_getsockname(lua_State *L);
38static int meth_getpeername(lua_State *L); 38static int meth_getpeername(lua_State *L);
39static int meth_gettimeout(lua_State *L);
39static int meth_setsockname(lua_State *L); 40static int meth_setsockname(lua_State *L);
40static int meth_setpeername(lua_State *L); 41static int meth_setpeername(lua_State *L);
41static int meth_close(lua_State *L); 42static int meth_close(lua_State *L);
@@ -66,6 +67,7 @@ static luaL_Reg udp_methods[] = {
66 {"setpeername", meth_setpeername}, 67 {"setpeername", meth_setpeername},
67 {"setsockname", meth_setsockname}, 68 {"setsockname", meth_setsockname},
68 {"settimeout", meth_settimeout}, 69 {"settimeout", meth_settimeout},
70 {"gettimeout", meth_gettimeout},
69 {NULL, NULL} 71 {NULL, NULL}
70}; 72};
71 73
@@ -347,6 +349,11 @@ static int meth_settimeout(lua_State *L) {
347 return timeout_meth_settimeout(L, &udp->tm); 349 return timeout_meth_settimeout(L, &udp->tm);
348} 350}
349 351
352static int meth_gettimeout(lua_State *L) {
353 p_udp udp = (p_udp) auxiliar_checkgroup(L, "udp{any}", 1);
354 return timeout_meth_gettimeout(L, &udp->tm);
355}
356
350/*-------------------------------------------------------------------------*\ 357/*-------------------------------------------------------------------------*\
351* Turns a master udp object into a client object. 358* Turns a master udp object into a client object.
352\*-------------------------------------------------------------------------*/ 359\*-------------------------------------------------------------------------*/