diff options
author | Kim Alvefur <zash@zash.se> | 2022-07-27 08:40:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-27 09:40:18 +0300 |
commit | d1ad8160cba9e504c9d17665492044a93efdc3ab (patch) | |
tree | f1fdc54ab108383324765104d08c35d09764839a /src/options.c | |
parent | 0c7df119c2b71bed814db7b3da8fc379131433fe (diff) | |
download | luasocket-d1ad8160cba9e504c9d17665492044a93efdc3ab.tar.gz luasocket-d1ad8160cba9e504c9d17665492044a93efdc3ab.tar.bz2 luasocket-d1ad8160cba9e504c9d17665492044a93efdc3ab.zip |
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>
Diffstat (limited to 'src/options.c')
-rw-r--r-- | src/options.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/options.c b/src/options.c index 51ea351..3280c51 100644 --- a/src/options.c +++ b/src/options.c | |||
@@ -207,6 +207,15 @@ int opt_set_tcp_fastopen_connect(lua_State *L, p_socket ps) | |||
207 | #endif | 207 | #endif |
208 | 208 | ||
209 | /*------------------------------------------------------*/ | 209 | /*------------------------------------------------------*/ |
210 | |||
211 | #ifdef TCP_DEFER_ACCEPT | ||
212 | int opt_set_tcp_defer_accept(lua_State *L, p_socket ps) | ||
213 | { | ||
214 | return opt_setint(L, ps, IPPROTO_TCP, TCP_DEFER_ACCEPT); | ||
215 | } | ||
216 | #endif | ||
217 | |||
218 | /*------------------------------------------------------*/ | ||
210 | int opt_set_ip6_unicast_hops(lua_State *L, p_socket ps) | 219 | int opt_set_ip6_unicast_hops(lua_State *L, p_socket ps) |
211 | { | 220 | { |
212 | return opt_setint(L, ps, IPPROTO_IPV6, IPV6_UNICAST_HOPS); | 221 | return opt_setint(L, ps, IPPROTO_IPV6, IPV6_UNICAST_HOPS); |