mirror of
https://github.com/lunarmodules/luasocket.git
synced 2024-12-25 12:08:21 +01:00
feat(tcp): Add support for TCP Fast Open
This commit is contained in:
parent
cff09ffb32
commit
0c7df119c2
@ -485,6 +485,10 @@ 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-keepintvl</tt>': value for <tt>TCP_KEEPINTVL</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>
|
||||||
|
|
||||||
<li> '<tt>ipv6-v6only</tt>':
|
<li> '<tt>ipv6-v6only</tt>':
|
||||||
Setting this option to <tt>true</tt> restricts an <tt>inet6</tt> socket to
|
Setting this option to <tt>true</tt> restricts an <tt>inet6</tt> socket to
|
||||||
sending and receiving only IPv6 packets.</li>
|
sending and receiving only IPv6 packets.</li>
|
||||||
|
@ -190,6 +190,22 @@ int opt_set_send_buf_size(lua_State *L, p_socket ps)
|
|||||||
return opt_setint(L, ps, SOL_SOCKET, SO_SNDBUF);
|
return opt_setint(L, ps, SOL_SOCKET, SO_SNDBUF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// /*------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef TCP_FASTOPEN
|
||||||
|
int opt_set_tcp_fastopen(lua_State *L, p_socket ps)
|
||||||
|
{
|
||||||
|
return opt_setint(L, ps, IPPROTO_TCP, TCP_FASTOPEN);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef TCP_FASTOPEN_CONNECT
|
||||||
|
int opt_set_tcp_fastopen_connect(lua_State *L, p_socket ps)
|
||||||
|
{
|
||||||
|
return opt_setint(L, ps, IPPROTO_TCP, TCP_FASTOPEN_CONNECT);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*------------------------------------------------------*/
|
/*------------------------------------------------------*/
|
||||||
int opt_set_ip6_unicast_hops(lua_State *L, p_socket ps)
|
int opt_set_ip6_unicast_hops(lua_State *L, p_socket ps)
|
||||||
{
|
{
|
||||||
|
@ -64,6 +64,13 @@ int opt_get_recv_buf_size(lua_State *L, p_socket ps);
|
|||||||
int opt_set_send_buf_size(lua_State *L, p_socket ps);
|
int opt_set_send_buf_size(lua_State *L, p_socket ps);
|
||||||
int opt_get_send_buf_size(lua_State *L, p_socket ps);
|
int opt_get_send_buf_size(lua_State *L, p_socket ps);
|
||||||
|
|
||||||
|
#ifdef TCP_FASTOPEN
|
||||||
|
int opt_set_tcp_fastopen(lua_State *L, p_socket ps);
|
||||||
|
#endif
|
||||||
|
#ifdef TCP_FASTOPEN_CONNECT
|
||||||
|
int opt_set_tcp_fastopen_connect(lua_State *L, p_socket ps);
|
||||||
|
#endif
|
||||||
|
|
||||||
int opt_set_ip6_unicast_hops(lua_State *L, p_socket ps);
|
int opt_set_ip6_unicast_hops(lua_State *L, p_socket ps);
|
||||||
int opt_get_ip6_unicast_hops(lua_State *L, p_socket ps);
|
int opt_get_ip6_unicast_hops(lua_State *L, p_socket ps);
|
||||||
|
|
||||||
|
@ -109,6 +109,12 @@ static t_opt optset[] = {
|
|||||||
{"linger", opt_set_linger},
|
{"linger", opt_set_linger},
|
||||||
{"recv-buffer-size", opt_set_recv_buf_size},
|
{"recv-buffer-size", opt_set_recv_buf_size},
|
||||||
{"send-buffer-size", opt_set_send_buf_size},
|
{"send-buffer-size", opt_set_send_buf_size},
|
||||||
|
#ifdef TCP_FASTOPEN
|
||||||
|
{"tcp-fastopen", opt_set_tcp_fastopen},
|
||||||
|
#endif
|
||||||
|
#ifdef TCP_FASTOPEN_CONNECT
|
||||||
|
{"tcp-fastopen-connect", opt_set_tcp_fastopen_connect},
|
||||||
|
#endif
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user