Commit d169281a authored by Luca Boccassi's avatar Luca Boccassi

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.
parent 82513060
...@@ -184,13 +184,13 @@ int zmq::tcp_listener_t::set_address (const char *addr_) ...@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment