Merge remote-tracking branch 'upstream/master' into tcp-defer-accept

This commit is contained in:
Caleb Maclennan 2022-07-27 09:21:00 +03:00
commit 6c0c6b8a13
No known key found for this signature in database
GPG key ID: B538286DE04ECFE5
5 changed files with 35 additions and 1 deletions

View file

@ -487,6 +487,10 @@ disables the Nagle's algorithm for the connection;</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>
<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>

View file

@ -34,7 +34,7 @@ local function make_plat(plat)
},
mingw32 = {
"LUASOCKET_DEBUG",
"LUASOCKET_INET_PTON",
-- "LUASOCKET_INET_PTON",
"WINVER=0x0501"
}
}
@ -113,6 +113,7 @@ local function make_plat(plat)
then
modules["socket.core"].sources[#modules["socket.core"].sources+1] = "src/wsocket.c"
modules["socket.core"].libraries = { "ws2_32" }
modules["socket.core"].libdirs = {}
end
return { modules = modules }
end

View file

@ -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);
}
// /*------------------------------------------------------*/
#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
/*------------------------------------------------------*/
#ifdef TCP_DEFER_ACCEPT

View file

@ -68,6 +68,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_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_get_ip6_unicast_hops(lua_State *L, p_socket ps);

View file

@ -111,6 +111,12 @@ static t_opt optset[] = {
{"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
#ifdef TCP_FASTOPEN_CONNECT
{"tcp-fastopen-connect", opt_set_tcp_fastopen_connect},
#endif
{NULL, NULL}
};