mirror of
https://github.com/zeromq/libzmq.git
synced 2025-02-19 13:59:37 +01: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
284c743814
commit
792ee7690e
@ -159,13 +159,13 @@ int zmq::tcp_listener_t::set_address (const char *addr_)
|
||||
#endif
|
||||
|
||||
// IPv6 address family not supported, try automatic downgrade to IPv4.
|
||||
if (address.family () == AF_INET6
|
||||
if (s == -1 && address.family () == AF_INET6
|
||||
&& errno == EAFNOSUPPORT
|
||||
&& options.ipv6) {
|
||||
rc = address.resolve (addr_, true, true);
|
||||
rc = address.resolve (addr_, true, false);
|
||||
if (rc != 0)
|
||||
return rc;
|
||||
s = ::socket (address.family (), SOCK_STREAM, IPPROTO_TCP);
|
||||
s = open_socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
}
|
||||
|
||||
#ifdef ZMQ_HAVE_WINDOWS
|
||||
|
Loading…
x
Reference in New Issue
Block a user