Commit bd632785 authored by antirez's avatar antirez
Browse files

Print error message when can't bind * on any address.

parent 2c94d80f
...@@ -1468,8 +1468,7 @@ void initServer() { ...@@ -1468,8 +1468,7 @@ void initServer() {
for (j = 0; j < server.bindaddr_count || j == 0; j++) { for (j = 0; j < server.bindaddr_count || j == 0; j++) {
if (server.bindaddr[j] == NULL) { if (server.bindaddr[j] == NULL) {
/* Bind * for both IPv6 and IPv4, we enter here only if /* Bind * for both IPv6 and IPv4, we enter here only if
* server.bindaddr_count == 0, so we try to bind and then * server.bindaddr_count == 0. */
* break to exit the loop ASAP. */
server.ipfd[server.ipfd_count] = server.ipfd[server.ipfd_count] =
anetTcp6Server(server.neterr,server.port,NULL); anetTcp6Server(server.neterr,server.port,NULL);
if (server.ipfd[server.ipfd_count] != ANET_ERR) if (server.ipfd[server.ipfd_count] != ANET_ERR)
...@@ -1478,7 +1477,10 @@ void initServer() { ...@@ -1478,7 +1477,10 @@ void initServer() {
anetTcpServer(server.neterr,server.port,NULL); anetTcpServer(server.neterr,server.port,NULL);
if(server.ipfd[server.ipfd_count] != ANET_ERR) if(server.ipfd[server.ipfd_count] != ANET_ERR)
server.ipfd_count++; server.ipfd_count++;
break; /* Exit the loop if we were able to bind * on IPv4 or IPv6,
* otherwise server.ipfd[server.ipfd_count] will be ANET_ERR
* and we'll print an error and exit. */
if (server.ipfd_count) break;
} else if (strchr(server.bindaddr[j],':')) { } else if (strchr(server.bindaddr[j],':')) {
/* Bind IPv6 address. */ /* Bind IPv6 address. */
server.ipfd[server.ipfd_count] = anetTcp6Server(server.neterr,server.port,server.bindaddr[j]); server.ipfd[server.ipfd_count] = anetTcp6Server(server.neterr,server.port,server.bindaddr[j]);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment