Commit fae3a4e0 authored by Constantin Rack's avatar Constantin Rack

Merge pull request #1911 from somdoron/FixUDPWindows

parents bf50f9fe 87e455f5
......@@ -439,13 +439,24 @@ u_short zmq::select_t::get_fd_family (fd_t fd_)
sockaddr_storage addr = { 0 };
int addr_size = sizeof addr;
int rc = getsockname (fd_, (sockaddr *)&addr, &addr_size);
int type;
int type_length = sizeof(int);
int rc = getsockopt(fd_, SOL_SOCKET, SO_TYPE, (char*) &type, &type_length);
if (rc == 0) {
if (type == SOCK_DGRAM)
return AF_INET;
else {
rc = getsockname(fd_, (sockaddr *)&addr, &addr_size);
// AF_INET and AF_INET6 can be mixed in select
// TODO: If proven otherwise, should simply return addr.sa_family
if (rc != SOCKET_ERROR)
return addr.ss_family == AF_INET6 ? AF_INET : addr.ss_family;
else
}
}
return AF_UNSPEC;
}
......
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