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
f9624813
Commit
f9624813
authored
Sep 09, 2016
by
antirez
Browse files
fix the fix for the TCP binding.
This commit attempts to fix a problem with PR #3467.
parent
92038286
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/server.c
View file @
f9624813
...
...
@@ -1644,19 +1644,24 @@ int listenToPort(int port, int *fds, int *count) {
if
(
fds
[
*
count
]
!=
ANET_ERR
)
{
anetNonBlock
(
NULL
,
fds
[
*
count
]);
(
*
count
)
++
;
}
else
if
(
errno
==
EAFNOSUPPORT
)
}
else
if
(
errno
==
EAFNOSUPPORT
)
{
unsupported
++
;
serverLog
(
LL_WARNING
,
"Not listening to IPv6: unsupproted"
);
}
/* Bind the IPv4 address as well. */
fds
[
*
count
]
=
anetTcpServer
(
server
.
neterr
,
port
,
NULL
,
server
.
tcp_backlog
);
if
(
fds
[
*
count
]
!=
ANET_ERR
)
{
anetNonBlock
(
NULL
,
fds
[
*
count
]);
(
*
count
)
++
;
}
else
if
(
errno
==
EAFNOSUPPORT
)
unsupported
++
;
if
(
*
count
==
1
||
unsupported
)
{
/* Bind the IPv4 address as well. */
fds
[
*
count
]
=
anetTcpServer
(
server
.
neterr
,
port
,
NULL
,
server
.
tcp_backlog
);
if
(
fds
[
*
count
]
!=
ANET_ERR
)
{
anetNonBlock
(
NULL
,
fds
[
*
count
]);
(
*
count
)
++
;
}
else
if
(
errno
==
EAFNOSUPPORT
)
{
unsupported
++
;
serverLog
(
LL_WARNING
,
"Not listening to IPv4: unsupproted"
);
}
}
/* Exit the loop if we were able to bind * on IPv4 and IPv6,
* or if one is unsupported by th OS.
* otherwise fds[*count] will be ANET_ERR and we'll print an
* error and return to the caller with an error. */
if
(
*
count
+
unsupported
==
2
)
break
;
...
...
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