diff options
author | Sam Roberts <vieuxtech@gmail.com> | 2012-04-11 14:18:20 -0700 |
---|---|---|
committer | Sam Roberts <vieuxtech@gmail.com> | 2012-04-11 14:18:20 -0700 |
commit | 4b671f4551e98ac9e1d9a7407d3dffdd7eb1d3dc (patch) | |
tree | ba92aa753ae1b145760cb1c5e69c886d3bf11328 /src/tcp.c | |
parent | f399ab25fcecad2ff96a5977e8eaf069bb45473c (diff) | |
parent | 195b2a74bb3f368b1f31f9c8bbc1ce0f54de2035 (diff) | |
download | luasocket-4b671f4551e98ac9e1d9a7407d3dffdd7eb1d3dc.tar.gz luasocket-4b671f4551e98ac9e1d9a7407d3dffdd7eb1d3dc.tar.bz2 luasocket-4b671f4551e98ac9e1d9a7407d3dffdd7eb1d3dc.zip |
Merge branch 'git-sam' into diego-sam-mwild-integration
Conflicts in options.c were just due to independent small functions
being close to each other.
unix.c in mwild was broken, it wasn't using LUASOCKET_API.
serial.c needed luaL_reg renamed, and to use LUASOCKET_API.
makefile didn't respect standard DESTDIR and prefix makefile
variables, and didn't allow LUAV variable to select lua version to build
against.
I've tested the top-level install-both target builds and installs
against both lua5.1 and lua5.2, but not done further testing.
Conflicts:
README
config
gem/ltn012.tex
makefile
src/makefile
src/options.c
src/options.h
src/tcp.c
src/usocket.c
Diffstat (limited to 'src/tcp.c')
-rw-r--r-- | src/tcp.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -33,6 +33,7 @@ static int meth_shutdown(lua_State *L); | |||
33 | static int meth_receive(lua_State *L); | 33 | static int meth_receive(lua_State *L); |
34 | static int meth_accept(lua_State *L); | 34 | static int meth_accept(lua_State *L); |
35 | static int meth_close(lua_State *L); | 35 | static int meth_close(lua_State *L); |
36 | static int meth_getoption(lua_State *L); | ||
36 | static int meth_setoption(lua_State *L); | 37 | static int meth_setoption(lua_State *L); |
37 | static int meth_settimeout(lua_State *L); | 38 | static int meth_settimeout(lua_State *L); |
38 | static int meth_getfd(lua_State *L); | 39 | static int meth_getfd(lua_State *L); |
@@ -49,6 +50,7 @@ static luaL_Reg tcp_methods[] = { | |||
49 | {"connect", meth_connect}, | 50 | {"connect", meth_connect}, |
50 | {"dirty", meth_dirty}, | 51 | {"dirty", meth_dirty}, |
51 | {"getfd", meth_getfd}, | 52 | {"getfd", meth_getfd}, |
53 | {"getoption", meth_getoption}, | ||
52 | {"getpeername", meth_getpeername}, | 54 | {"getpeername", meth_getpeername}, |
53 | {"getsockname", meth_getsockname}, | 55 | {"getsockname", meth_getsockname}, |
54 | {"getstats", meth_getstats}, | 56 | {"getstats", meth_getstats}, |
@@ -66,6 +68,14 @@ static luaL_Reg tcp_methods[] = { | |||
66 | }; | 68 | }; |
67 | 69 | ||
68 | /* socket option handlers */ | 70 | /* socket option handlers */ |
71 | static t_opt optget[] = { | ||
72 | {"keepalive", opt_get_keepalive}, | ||
73 | {"reuseaddr", opt_get_reuseaddr}, | ||
74 | {"tcp-nodelay", opt_get_tcp_nodelay}, | ||
75 | {"linger", opt_get_linger}, | ||
76 | {NULL, NULL} | ||
77 | }; | ||
78 | |||
69 | static t_opt optset[] = { | 79 | static t_opt optset[] = { |
70 | {"keepalive", opt_set_keepalive}, | 80 | {"keepalive", opt_set_keepalive}, |
71 | {"reuseaddr", opt_set_reuseaddr}, | 81 | {"reuseaddr", opt_set_reuseaddr}, |
@@ -130,6 +140,12 @@ static int meth_setstats(lua_State *L) { | |||
130 | /*-------------------------------------------------------------------------*\ | 140 | /*-------------------------------------------------------------------------*\ |
131 | * Just call option handler | 141 | * Just call option handler |
132 | \*-------------------------------------------------------------------------*/ | 142 | \*-------------------------------------------------------------------------*/ |
143 | static int meth_getoption(lua_State *L) | ||
144 | { | ||
145 | p_tcp tcp = (p_tcp) auxiliar_checkgroup(L, "tcp{any}", 1); | ||
146 | return opt_meth_getoption(L, optget, &tcp->sock); | ||
147 | } | ||
148 | |||
133 | static int meth_setoption(lua_State *L) | 149 | static int meth_setoption(lua_State *L) |
134 | { | 150 | { |
135 | p_tcp tcp = (p_tcp) auxiliar_checkgroup(L, "tcp{any}", 1); | 151 | p_tcp tcp = (p_tcp) auxiliar_checkgroup(L, "tcp{any}", 1); |