提交 9e089e7c 编写于 作者: A antirez

anet.c: use SO_REUSEADDR when creating listening sockets.

It used to be ok, but the socket option was removed when adding IPv6
support.
上级 cdf801d9
......@@ -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)
continue;
if (af == AF_INET6 && anetV6Only(err,s) == ANET_ERR)
goto error; /* could continue here? */
if (anetListen(err,s,p->ai_addr,p->ai_addrlen) == ANET_ERR)
goto error; /* could continue here? */
if (af == AF_INET6 && anetV6Only(err,s) == ANET_ERR) goto error;
if (anetSetReuseAddr(err,s) == ANET_ERR) goto error;
if (anetListen(err,s,p->ai_addr,p->ai_addrlen) == ANET_ERR) goto error;
goto end;
}
if (p == NULL) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册