mirror of
https://github.com/lunarmodules/luasocket.git
synced 2024-11-08 14:28:21 +01:00
feat(tcp): Add support for TCP Defer Accept
This makes it so that a listening socket does not become readable for accept() until a connection has been fully established *and* started sending something, thus the program doesn't have to wait for the first data. This only makes sense for client-speaks-first protocols. Co-authored-by: Caleb Maclennan <caleb@alerque.com>
This commit is contained in:
parent
0c7df119c2
commit
d1ad8160cb
@ -485,6 +485,8 @@ disables the Nagle's algorithm for the connection;</li>
|
||||
|
||||
<li> '<tt>tcp-keepintvl</tt>': value for <tt>TCP_KEEPINTVL</tt> Linux only!!</li>
|
||||
|
||||
<li> '<tt>tcp-defer-accept</tt>': value for <tt>TCP_DEFER_ACCEPT</tt> Linux only!!</li>
|
||||
|
||||
<li> '<tt>tcp-fastopen</tt>': value for <tt>TCP_FASTOPEN</tt> Linux only!!</li>
|
||||
|
||||
<li> '<tt>tcp-fastopen-connect</tt>': value for <tt>TCP_FASTOPEN_CONNECT</tt> Linux only!!</li>
|
||||
|
@ -206,6 +206,15 @@ int opt_set_tcp_fastopen_connect(lua_State *L, p_socket ps)
|
||||
}
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------*/
|
||||
|
||||
#ifdef TCP_DEFER_ACCEPT
|
||||
int opt_set_tcp_defer_accept(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_setint(L, ps, IPPROTO_TCP, TCP_DEFER_ACCEPT);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------*/
|
||||
int opt_set_ip6_unicast_hops(lua_State *L, p_socket ps)
|
||||
{
|
||||
|
@ -49,6 +49,10 @@ int opt_set_tcp_keepintvl(lua_State *L, p_socket ps);
|
||||
int opt_get_tcp_keepintvl(lua_State *L, p_socket ps);
|
||||
#endif
|
||||
|
||||
#ifdef TCP_DEFER_ACCEPT
|
||||
int opt_set_tcp_defer_accept(lua_State *L, p_socket ps);
|
||||
#endif
|
||||
|
||||
int opt_set_keepalive(lua_State *L, p_socket ps);
|
||||
int opt_get_keepalive(lua_State *L, p_socket ps);
|
||||
|
||||
|
@ -109,6 +109,9 @@ static t_opt optset[] = {
|
||||
{"linger", opt_set_linger},
|
||||
{"recv-buffer-size", opt_set_recv_buf_size},
|
||||
{"send-buffer-size", opt_set_send_buf_size},
|
||||
#ifdef TCP_DEFER_ACCEPT
|
||||
{"tcp-defer-accept", opt_set_tcp_defer_accept},
|
||||
#endif
|
||||
#ifdef TCP_FASTOPEN
|
||||
{"tcp-fastopen", opt_set_tcp_fastopen},
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user