Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deps/libuv
Submodule libuv updated 118 files
39 changes: 1 addition & 38 deletions docs/docs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2210,24 +2210,9 @@ local doc = {
name = 'tcp_keepalive',
method_form = 'tcp:keepalive(enable, [delay])',
desc = [[
Enable / disable TCP keep-alive. `delay` is the initial delay in seconds,
Enable / disable TCP keep-alive. `delay` is the initial delay in seconds, `intvl` is the time in seconds between individual keep-alive probes, and `cnt` is the number of probes to send before assuming the connection is dead.
ignored when enable is `false`.
]],
params = {
{ name = 'tcp', type = 'uv_tcp_t' },
{ name = 'enable', type = 'boolean' },
{ name = 'delay', type = opt_int },
},
returns = success_ret,
},
{
name = 'tcp_keepalive_ex',
method_form = 'tcp:keepalive_ex(enable, [delay], [intvl], [cnt])',
desc = [[
Enable / disable TCP keep-alive with all socket options: TCP_KEEPIDLE, TCP_KEEPINTVL and TCP_KEEPCNT. `delay` is the value for TCP_KEEPIDLE, `intvl` is the value for TCP_KEEPINTVL, `cnt` is the value for TCP_KEEPCNT, ignored when `enable` is `false`.

With TCP keep-alive enabled, idle is the time (in seconds) the connection needs to remain idle before TCP starts sending keep-alive probes. intvl is the time (in seconds) between individual keep-alive probes. TCP will drop the connection after sending cnt probes without getting any replies from the peer, then the handle is destroyed with a UV_ETIMEDOUT error passed to the corresponding callback.
]],
params = {
{ name = 'tcp', type = 'uv_tcp_t' },
{ name = 'enable', type = 'boolean' },
Expand Down Expand Up @@ -2860,28 +2845,6 @@ local doc = {
Note: The passed file descriptor or SOCKET is not checked for its type, but
it's required that it represents a valid datagram socket.
]],
params = {
{ name = 'udp', type = 'uv_udp_t' },
{ name = 'fd', type = 'integer' },
},
returns = success_ret,
},
{
name = 'udp_open_ex',
method_form = 'udp:open_ex(fd, [flags])',
desc = [[
Opens an existing file descriptor or Windows SOCKET as a UDP handle.

Unix only: The only requirement of the sock argument is that it follows the
datagram contract (works in unconnected mode, supports sendmsg()/recvmsg(),
etc). In other words, other datagram-type sockets like raw sockets or netlink
sockets can also be passed to this function.

The file descriptor is set to non-blocking mode.

Note: The passed file descriptor or SOCKET is not checked for its type, but
it's required that it represents a valid datagram socket.
]],
params = {
{ name = 'udp', type = 'uv_udp_t' },
{ name = 'fd', type = 'integer' },
Expand Down
45 changes: 4 additions & 41 deletions docs/docs.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

70 changes: 7 additions & 63 deletions docs/meta.lua

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions src/luv.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,6 @@ static const luaL_Reg luv_functions[] = {
{"tcp_open", luv_tcp_open},
{"tcp_nodelay", luv_tcp_nodelay},
{"tcp_keepalive", luv_tcp_keepalive},
#if LUV_UV_VERSION_GEQ(1, 52, 0)
{"tcp_keepalive_ex", luv_tcp_keepalive_ex},
#endif
{"tcp_simultaneous_accepts", luv_tcp_simultaneous_accepts},
{"tcp_bind", luv_tcp_bind},
{"tcp_getpeername", luv_tcp_getpeername},
Expand Down Expand Up @@ -218,9 +215,6 @@ static const luaL_Reg luv_functions[] = {
{"udp_get_send_queue_size", luv_udp_get_send_queue_size},
{"udp_get_send_queue_count", luv_udp_get_send_queue_count},
{"udp_open", luv_udp_open},
#if LUV_UV_VERSION_GEQ(1, 52, 0)
{"udp_open_ex", luv_udp_open_ex},
#endif
{"udp_bind", luv_udp_bind},
{"udp_getsockname", luv_udp_getsockname},
{"udp_set_membership", luv_udp_set_membership},
Expand Down Expand Up @@ -562,9 +556,6 @@ static const luaL_Reg luv_tcp_methods[] = {
{"open", luv_tcp_open},
{"nodelay", luv_tcp_nodelay},
{"keepalive", luv_tcp_keepalive},
#if LUV_UV_VERSION_GEQ(1, 52, 0)
{"keepalive_ex", luv_tcp_keepalive_ex},
#endif
{"simultaneous_accepts", luv_tcp_simultaneous_accepts},
{"bind", luv_tcp_bind},
{"getpeername", luv_tcp_getpeername},
Expand Down Expand Up @@ -599,9 +590,6 @@ static const luaL_Reg luv_udp_methods[] = {
{"get_send_queue_size", luv_udp_get_send_queue_size},
{"get_send_queue_count", luv_udp_get_send_queue_count},
{"open", luv_udp_open},
#if LUV_UV_VERSION_GEQ(1, 52, 0)
{"open_ex", luv_udp_open_ex},
#endif
{"bind", luv_udp_bind},
{"getsockname", luv_udp_getsockname},
{"set_membership", luv_udp_set_membership},
Expand Down
22 changes: 7 additions & 15 deletions src/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,31 +82,23 @@ static int luv_tcp_keepalive(lua_State* L) {
unsigned int delay = 0;
luaL_checktype(L, 2, LUA_TBOOLEAN);
enable = lua_toboolean(L, 2);
if (enable) {
delay = luaL_checkinteger(L, 3);
}
ret = uv_tcp_keepalive(handle, enable, delay);
return luv_result(L, ret);
}

#if LUV_UV_VERSION_GEQ(1, 52, 0)
static int luv_tcp_keepalive_ex(lua_State* L) {
uv_tcp_t* handle = luv_check_tcp(L, 1);
int ret, enable;
unsigned int delay = 0;
#if LUV_UV_VERSION_GEQ(1, 52, 0)
unsigned int intvl = 1; // defaults chosen in uv_tcp_keepalive on libuv 1.52.0
unsigned int cnt = 10; // defaults chosen in uv_tcp_keepalive on libuv 1.52.0
luaL_checktype(L, 2, LUA_TBOOLEAN);
enable = lua_toboolean(L, 2);
if (enable) {
delay = luaL_checkinteger(L, 3);
intvl = luaL_optinteger(L, 4, intvl);
cnt = luaL_optinteger(L, 5, cnt);
}
ret = uv_tcp_keepalive_ex(handle, enable, delay, intvl, cnt);
#else
if (enable) {
delay = luaL_checkinteger(L, 3);
}
ret = uv_tcp_keepalive(handle, enable, delay);
#endif
return luv_result(L, ret);
}
#endif

static int luv_tcp_simultaneous_accepts(lua_State* L) {
uv_tcp_t* handle = luv_check_tcp(L, 1);
Expand Down
14 changes: 5 additions & 9 deletions src/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,9 @@ static int luv_udp_get_send_queue_count(lua_State* L) {
static int luv_udp_open(lua_State* L) {
uv_udp_t* handle = luv_check_udp(L, 1);
uv_os_sock_t sock = luaL_checkinteger(L, 2);
int ret = uv_udp_open(handle, sock);
return luv_result(L, ret);
}

#if LUV_UV_VERSION_GEQ(1, 52, 0)
static int luv_udp_open_ex(lua_State* L) {
uv_udp_t* handle = luv_check_udp(L, 1);
uv_os_sock_t sock = luaL_checkinteger(L, 2);
#if LUV_UV_VERSION_GEQ(1, 52, 0)
unsigned int flags = 0;

if (!lua_isnoneornil(L, 3)) {
if (lua_isinteger(L, 3)) {
flags = (unsigned int)lua_tointeger(L, 3);
Expand All @@ -151,9 +145,11 @@ static int luv_udp_open_ex(lua_State* L) {
}

int ret = uv_udp_open_ex(handle, sock, flags);
#else
int ret = uv_udp_open(handle, sock);
#endif
return luv_result(L, ret);
}
#endif

static int luv_udp_bind(lua_State* L) {
uv_udp_t* handle = luv_check_udp(L, 1);
Expand Down
Loading