mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 09:00:51 +00:00
anet.c: use SO_REUSEADDR when creating listening sockets.
It used to be ok, but the socket option was removed when adding IPv6 support.
This commit is contained in:
parent
d1cbad6d14
commit
d83dca4c79
@ -392,11 +392,9 @@ static int _anetTcpServer(char *err, int port, char *bindaddr, int af)
|
|||||||
if ((s = socket(p->ai_family,p->ai_socktype,p->ai_protocol)) == -1)
|
if ((s = socket(p->ai_family,p->ai_socktype,p->ai_protocol)) == -1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (af == AF_INET6 && anetV6Only(err,s) == ANET_ERR)
|
if (af == AF_INET6 && anetV6Only(err,s) == ANET_ERR) goto error;
|
||||||
goto error; /* could continue here? */
|
if (anetSetReuseAddr(err,s) == ANET_ERR) goto error;
|
||||||
|
if (anetListen(err,s,p->ai_addr,p->ai_addrlen) == ANET_ERR) goto error;
|
||||||
if (anetListen(err,s,p->ai_addr,p->ai_addrlen) == ANET_ERR)
|
|
||||||
goto error; /* could continue here? */
|
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user