mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
Add static anetV6Only() function.
This function sets the IPV6_V6ONLY option to 1 to use separate stack IPv6 sockets.
This commit is contained in:
parent
62a3b7e3d9
commit
72a3922617
10
src/anet.c
10
src/anet.c
@ -362,6 +362,16 @@ static int anetListen(char *err, int s, struct sockaddr *sa, socklen_t len) {
|
||||
return ANET_OK;
|
||||
}
|
||||
|
||||
static int anetV6Only(char *err, int s) {
|
||||
int yes = 1;
|
||||
if (setsockopt(s,IPPROTO_IPV6,IPV6_V6ONLY,&yes,sizeof(yes)) == -1) {
|
||||
anetSetError(err, "setsockopt: %s", strerror(errno));
|
||||
close(s);
|
||||
return ANET_ERR;
|
||||
}
|
||||
return ANET_OK;
|
||||
}
|
||||
|
||||
int anetTcpServer(char *err, int port, char *bindaddr)
|
||||
{
|
||||
int s, rv;
|
||||
|
Loading…
Reference in New Issue
Block a user