Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
cba7a4e6
Commit
cba7a4e6
authored
Jul 25, 2013
by
Allan
Browse files
fixed initServer failed if no IPV4 or no IPV6
parent
1e7cff23
Changes
1
Show whitespace changes
Inline
Side-by-side
src/redis.c
View file @
cba7a4e6
...
@@ -1403,6 +1403,7 @@ void adjustOpenFilesLimit(void) {
...
@@ -1403,6 +1403,7 @@ 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
);
...
@@ -1434,12 +1435,18 @@ void initServer() {
...
@@ -1434,12 +1435,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.
server
.
ipfd
[
server
.
ipfd_count
]
=
anetTcp6Server
(
server
.
neterr
,
server
.
port
,
NULL
);
* Should consider that someone only has IPV6 and someone only get IPV4 */
if
(
server
.
ipfd
[
server
.
ipfd_count
]
!=
ANET_ERR
)
server
.
ipfd_count
++
;
ip_count
=
0
;
server
.
ipfd
[
ip_count
]
=
anetTcp6Server
(
server
.
neterr
,
server
.
port
,
NULL
);
server
.
ipfd
[
server
.
ipfd_count
]
=
anetTcpServer
(
server
.
neterr
,
server
.
port
,
NULL
);
if
(
server
.
ipfd
[
ip_count
]
!=
ANET_ERR
)
ip_count
++
;
server
.
ipfd
[
ip_count
]
=
anetTcpServer
(
server
.
neterr
,
server
.
port
,
NULL
);
if
(
server
.
ipfd
[
ip_count
]
!=
ANET_ERR
)
ip_count
++
;
/* It should be ip_count plus one
* because out of this branch, the server.ipfd_count would increase */
server
.
ipfd_count
=
ip_count
-
1
;
}
else
if
(
strchr
(
server
.
bindaddr
[
j
],
':'
))
{
}
else
if
(
strchr
(
server
.
bindaddr
[
j
],
':'
))
{
/* Bind IPv6 address. */
/* Bind IPv6 address. */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment