mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 00:28:26 -05:00
Fix for issue #1214 simplified.
This commit is contained in:
parent
038e356dbc
commit
35a977c499
26
src/redis.c
26
src/redis.c
@ -1476,7 +1476,6 @@ void adjustOpenFilesLimit(void) {
|
|||||||
|
|
||||||
void initServer() {
|
void initServer() {
|
||||||
int j;
|
int j;
|
||||||
int ip_count;
|
|
||||||
|
|
||||||
signal(SIGHUP, SIG_IGN);
|
signal(SIGHUP, SIG_IGN);
|
||||||
signal(SIGPIPE, SIG_IGN);
|
signal(SIGPIPE, SIG_IGN);
|
||||||
@ -1508,19 +1507,18 @@ void initServer() {
|
|||||||
if (server.bindaddr_count == 0) server.bindaddr[0] = NULL;
|
if (server.bindaddr_count == 0) server.bindaddr[0] = NULL;
|
||||||
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.
|
/* Bind * for both IPv6 and IPv4, we enter here only if
|
||||||
* Should consider that someone only has IPV6 and someone only get IPV4 */
|
* server.bindaddr_count == 0, so we try to bind and then
|
||||||
ip_count = 0;
|
* break to exit the loop ASAP. */
|
||||||
server.ipfd[ip_count] = anetTcp6Server(server.neterr,server.port,NULL);
|
server.ipfd[server.ipfd_count] =
|
||||||
if (server.ipfd[ip_count] != ANET_ERR) ip_count++;
|
anetTcp6Server(server.neterr,server.port,NULL);
|
||||||
|
if (server.ipfd[server.ipfd_count] != ANET_ERR)
|
||||||
server.ipfd[ip_count] = anetTcpServer(server.neterr,server.port,NULL);
|
server.ipfd_count++;
|
||||||
if(server.ipfd[ip_count] != ANET_ERR ) ip_count++;
|
server.ipfd[server.ipfd_count] =
|
||||||
|
anetTcpServer(server.neterr,server.port,NULL);
|
||||||
/* It should be ip_count plus one
|
if(server.ipfd[server.ipfd_count] != ANET_ERR)
|
||||||
* because out of this branch, the server.ipfd_count would increase */
|
server.ipfd_count++;
|
||||||
server.ipfd_count += (ip_count - 1);
|
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]);
|
||||||
|
Loading…
Reference in New Issue
Block a user