mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-02 03:08:04 +08:00
Merge pull request #2210 from bluca/ipv6_tos_v4_only
Problem: IPV6_TCLASS setsockopt fails on IPv4 socket
This commit is contained in:
commit
b9b0fd87a4
12
src/ip.cpp
12
src/ip.cpp
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user