mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-09 15:26:04 +00:00
Problem: zmq_bind IPv4 fallback still tries IPv6
Solution: if opening an IPv6 TCP socket fails because IPv6 is not available, try to open an IPv4 socket instead when creating and binding a TCP endpoint.
This commit is contained in:
parent
8251306012
commit
d169281a00
@ -184,13 +184,13 @@ int zmq::tcp_listener_t::set_address (const char *addr_)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// IPv6 address family not supported, try automatic downgrade to IPv4.
|
// IPv6 address family not supported, try automatic downgrade to IPv4.
|
||||||
if (address.family () == AF_INET6
|
if (s == -1 && address.family () == AF_INET6
|
||||||
&& errno == EAFNOSUPPORT
|
&& errno == EAFNOSUPPORT
|
||||||
&& options.ipv6) {
|
&& options.ipv6) {
|
||||||
rc = address.resolve (addr_, true, true);
|
rc = address.resolve (addr_, true, false);
|
||||||
if (rc != 0)
|
if (rc != 0)
|
||||||
return rc;
|
return rc;
|
||||||
s = ::socket (address.family (), SOCK_STREAM, IPPROTO_TCP);
|
s = open_socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ZMQ_HAVE_WINDOWS
|
#ifdef ZMQ_HAVE_WINDOWS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user