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.
This commit is contained in:
parent
1d61853ab8
commit
9cda037d9d
4 changed files with 18 additions and 0 deletions
|
@ -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>ipv6-v6only</tt>':
|
||||
Setting this option to <tt>true</tt> restricts an <tt>inet6</tt> socket to
|
||||
sending and receiving only IPv6 packets.</li>
|
||||
|
|
|
@ -190,6 +190,15 @@ int opt_set_send_buf_size(lua_State *L, p_socket ps)
|
|||
return opt_setint(L, ps, SOL_SOCKET, SO_SNDBUF);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------*/
|
||||
|
||||
#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
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue