Commit 90f091ab authored by Luca Boccassi's avatar Luca Boccassi

Problem: IPV6_TCLASS setsockopt fails on IPv4 socket

Solution: if setsockopt errors out and errno is set to ENOPROTOOPT
(or EINVAL on OSX) ignore it and carry on.
parent bc186043
......@@ -180,9 +180,17 @@ void zmq::set_ip_type_of_service (fd_t s_, int iptos)
reinterpret_cast<const char*>(&iptos),
sizeof(iptos));
// If IPv6 is not enabled ENOPROTOOPT will be returned on Windows and
// Linux, and EINVAL on OSX
#ifdef ZMQ_HAVE_WINDOWS
wsa_assert (rc != SOCKET_ERROR);
if (rc == SOCKET_ERROR) {
const int last_error = WSAGetLastError();
wsa_assert (last_error == WSAENOPROTOOPT);
}
#else
errno_assert (rc == 0);
if (rc == -1) {
errno_assert (errno == ENOPROTOOPT ||
errno == EINVAL);
}
#endif
}
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