diff options
Diffstat (limited to 'src/redis.c')
-rw-r--r-- | src/redis.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/redis.c b/src/redis.c index 88743550f..38737ea07 100644 --- a/src/redis.c +++ b/src/redis.c @@ -1615,10 +1615,16 @@ int listenToPort(int port, int *fds, int *count) { * server.bindaddr_count == 0. */ fds[*count] = anetTcp6Server(server.neterr,port,NULL, server.tcp_backlog); - if (fds[*count] != ANET_ERR) (*count)++; + if (fds[*count] != ANET_ERR) { + anetNonBlock(NULL,fds[*count]); + (*count)++; + } fds[*count] = anetTcpServer(server.neterr,port,NULL, server.tcp_backlog); - if (fds[*count] != ANET_ERR) (*count)++; + if (fds[*count] != ANET_ERR) { + anetNonBlock(NULL,fds[*count]); + (*count)++; + } /* Exit the loop if we were able to bind * on IPv4 or IPv6, * otherwise fds[*count] will be ANET_ERR and we'll print an * error and return to the caller with an error. */ @@ -1639,6 +1645,7 @@ int listenToPort(int port, int *fds, int *count) { port, server.neterr); return REDIS_ERR; } + anetNonBlock(NULL,fds[*count]); (*count)++; } return REDIS_OK; @@ -1708,6 +1715,7 @@ void initServer() { redisLog(REDIS_WARNING, "Opening socket: %s", server.neterr); exit(1); } + anetNonBlock(NULL,server.sofd); } /* Abort if there are no listening sockets at all. */ |