diff options
Diffstat (limited to 'src/tcp.c')
-rw-r--r-- | src/tcp.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -70,6 +70,7 @@ static t_opt optset[] = { | |||
70 | {"keepalive", opt_set_keepalive}, | 70 | {"keepalive", opt_set_keepalive}, |
71 | {"reuseaddr", opt_set_reuseaddr}, | 71 | {"reuseaddr", opt_set_reuseaddr}, |
72 | {"tcp-nodelay", opt_set_tcp_nodelay}, | 72 | {"tcp-nodelay", opt_set_tcp_nodelay}, |
73 | {"ipv6-v6only", opt_set_ip6_v6only}, | ||
73 | {"linger", opt_set_linger}, | 74 | {"linger", opt_set_linger}, |
74 | {NULL, NULL} | 75 | {NULL, NULL} |
75 | }; | 76 | }; |
@@ -334,6 +335,11 @@ static int tcp_create(lua_State *L, int domain) { | |||
334 | auxiliar_setclass(L, "tcp{master}", -1); | 335 | auxiliar_setclass(L, "tcp{master}", -1); |
335 | /* initialize remaining structure fields */ | 336 | /* initialize remaining structure fields */ |
336 | socket_setnonblocking(&sock); | 337 | socket_setnonblocking(&sock); |
338 | if (domain == PF_INET6) { | ||
339 | int yes = 1; | ||
340 | setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, | ||
341 | (void *)&yes, sizeof(yes)); | ||
342 | } | ||
337 | tcp->sock = sock; | 343 | tcp->sock = sock; |
338 | io_init(&tcp->io, (p_send) socket_send, (p_recv) socket_recv, | 344 | io_init(&tcp->io, (p_send) socket_send, (p_recv) socket_recv, |
339 | (p_error) socket_ioerror, &tcp->sock); | 345 | (p_error) socket_ioerror, &tcp->sock); |