diff --git a/docs/tcp.html b/docs/tcp.html index 714a327..a26228d 100644 --- a/docs/tcp.html +++ b/docs/tcp.html @@ -487,6 +487,10 @@ disables the Nagle's algorithm for the connection;
  • 'tcp-defer-accept': value for TCP_DEFER_ACCEPT Linux only!!
  • +
  • 'tcp-fastopen': value for TCP_FASTOPEN Linux only!!
  • + +
  • 'tcp-fastopen-connect': value for TCP_FASTOPEN_CONNECT Linux only!!
  • +
  • 'ipv6-v6only': Setting this option to true restricts an inet6 socket to sending and receiving only IPv6 packets.
  • diff --git a/luasocket-scm-3.rockspec b/luasocket-scm-3.rockspec index 71f335c..1045251 100644 --- a/luasocket-scm-3.rockspec +++ b/luasocket-scm-3.rockspec @@ -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 diff --git a/src/options.c b/src/options.c index 6f3aa4a..3280c51 100644 --- a/src/options.c +++ b/src/options.c @@ -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 diff --git a/src/options.h b/src/options.h index 00d36bc..456eeb5 100644 --- a/src/options.h +++ b/src/options.h @@ -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); diff --git a/src/tcp.c b/src/tcp.c index 7906d47..e84db84 100644 --- a/src/tcp.c +++ b/src/tcp.c @@ -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} };