Unverified Commit 6a9c6d42 authored by Luca Boccassi's avatar Luca Boccassi Committed by GitHub

Merge pull request #3111 from sigiesec/win-draft-fix-and-migrate-test

Reenable DRAFT builds on Appveyor and fix test_radio_dish_udp_ipv6
parents 79530836 e78d20ff
......@@ -93,7 +93,7 @@ before_build:
- cmd: set LIBZMQ_BUILDDIR=C:\projects\build_libzmq
- cmd: md "%LIBZMQ_BUILDDIR%"
- cd "%LIBZMQ_BUILDDIR%"
- cmd: cmake -D CMAKE_INCLUDE_PATH="%SODIUM_INCLUDE_DIR%" -D CMAKE_LIBRARY_PATH="%SODIUM_LIBRARY_DIR%" -D WITH_LIBSODIUM="%WITH_LIBSODIUM%" -D ENABLE_CURVE="%ENABLE_CURVE%" -D POLLER="%POLLER%" -D CMAKE_C_FLAGS_RELEASE="/MT" -D CMAKE_C_FLAGS_DEBUG="/MTd" -D WITH_LIBSODIUM="%WITH_LIBSODIUM%" -D LIBZMQ_WERROR="ON" -G "%CMAKE_GENERATOR%" "%APPVEYOR_BUILD_FOLDER%"
- cmd: cmake -D CMAKE_INCLUDE_PATH="%SODIUM_INCLUDE_DIR%" -D CMAKE_LIBRARY_PATH="%SODIUM_LIBRARY_DIR%" -D WITH_LIBSODIUM="%WITH_LIBSODIUM%" -D ENABLE_DRAFTS="ON" -D ENABLE_CURVE="%ENABLE_CURVE%" -D POLLER="%POLLER%" -D CMAKE_C_FLAGS_RELEASE="/MT" -D CMAKE_C_FLAGS_DEBUG="/MTd" -D WITH_LIBSODIUM="%WITH_LIBSODIUM%" -D LIBZMQ_WERROR="ON" -G "%CMAKE_GENERATOR%" "%APPVEYOR_BUILD_FOLDER%"
build:
parallel: true
......
......@@ -425,8 +425,8 @@ void zmq::udp_engine_t::restart_output ()
void zmq::udp_engine_t::in_event ()
{
struct sockaddr_in in_address;
socklen_t in_addrlen = sizeof (sockaddr_in);
sockaddr_storage in_address;
socklen_t in_addrlen = sizeof (sockaddr_storage);
#ifdef ZMQ_HAVE_WINDOWS
int nbytes = recvfrom (fd, (char *) in_buffer, MAX_UDP_MSG, 0,
(sockaddr *) &in_address, &in_addrlen);
......@@ -459,7 +459,8 @@ void zmq::udp_engine_t::in_event ()
msg_t msg;
if (options.raw_socket) {
sockaddr_to_msg (&msg, &in_address);
zmq_assert (in_address.ss_family == AF_INET);
sockaddr_to_msg (&msg, reinterpret_cast<sockaddr_in *> (&in_address));
body_size = nbytes;
body_offset = 0;
......
......@@ -280,8 +280,8 @@ union sa_u
static bool is_multicast_available (int ipv6_)
{
int family = ipv6_ ? AF_INET6 : AF_INET;
int bind_sock = -1;
int send_sock = -1;
fd_t bind_sock = retired_fd;
fd_t send_sock = retired_fd;
int port = 5555;
bool success = false;
const char *msg = "it works";
......@@ -357,15 +357,15 @@ static bool is_multicast_available (int ipv6_)
mreq.ipv6mr_multiaddr = mcast_ipv6->sin6_addr;
mreq.ipv6mr_interface = 0;
rc = setsockopt (bind_sock, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, &mreq,
sizeof (mreq));
rc = setsockopt (bind_sock, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP,
as_setsockopt_opt_t (&mreq), sizeof (mreq));
if (rc < 0) {
goto out;
}
int loop = 1;
rc = setsockopt (send_sock, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, &loop,
sizeof (loop));
rc = setsockopt (send_sock, IPPROTO_IPV6, IPV6_MULTICAST_LOOP,
as_setsockopt_opt_t (&loop), sizeof (loop));
if (rc < 0) {
goto out;
}
......@@ -376,15 +376,15 @@ static bool is_multicast_available (int ipv6_)
mreq.imr_multiaddr = mcast_ipv4->sin_addr;
mreq.imr_interface.s_addr = htonl (INADDR_ANY);
rc = setsockopt (bind_sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq,
sizeof (mreq));
rc = setsockopt (bind_sock, IPPROTO_IP, IP_ADD_MEMBERSHIP,
as_setsockopt_opt_t (&mreq), sizeof (mreq));
if (rc < 0) {
goto out;
}
int loop = 1;
rc = setsockopt (send_sock, IPPROTO_IP, IP_MULTICAST_LOOP, &loop,
sizeof (loop));
rc = setsockopt (send_sock, IPPROTO_IP, IP_MULTICAST_LOOP,
as_setsockopt_opt_t (&loop), sizeof (loop));
if (rc < 0) {
goto out;
}
......@@ -392,7 +392,8 @@ static bool is_multicast_available (int ipv6_)
msleep (SETTLE_TIME);
rc = sendto (send_sock, msg, strlen (msg), 0, &mcast.generic, sl);
rc = sendto (send_sock, msg, static_cast<socklen_t> (strlen (msg)), 0,
&mcast.generic, sl);
if (rc < 0) {
goto out;
}
......
......@@ -92,6 +92,10 @@
#ifdef ZMQ_HAVE_WINDOWS
#define close closesocket
typedef int socket_size_t;
const char *as_setsockopt_opt_t (const void *opt)
{
return static_cast<const char *> (opt);
}
#if defined _MSC_VER && _MSC_VER <= 1400
typedef UINT_PTR fd_t;
enum
......@@ -107,6 +111,10 @@ enum
#endif
#else
typedef size_t socket_size_t;
const void *as_setsockopt_opt_t (const void *opt)
{
return opt;
}
typedef int fd_t;
enum
{
......
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