Cleanup the remaining of HAVE_UV_<func> macros
While cleaning up the usage of HAVE_UV_<func> macros, we forgot to cleanup the HAVE_UV_UDP_CONNECT in the actual code and HAVE_UV_TRANSLATE_SYS_ERROR and this was causing Windows build to fail on uv_udp_send() because the socket was already connected and we were falsely assuming that it was not. The platforms with autoconf support were not affected, because we were still checking for the functions from the configure.
This commit is contained in:
12
configure.ac
12
configure.ac
@@ -593,18 +593,6 @@ AC_CHECK_HEADERS([pthread_np.h], [], [], [#include <pthread.h>])
|
||||
AC_MSG_CHECKING([for libuv])
|
||||
PKG_CHECK_MODULES([LIBUV], [libuv >= 1.0.0], [],
|
||||
[AC_MSG_ERROR([libuv not found])])
|
||||
AX_SAVE_FLAGS([libuv])
|
||||
|
||||
CFLAGS="$CFLAGS $LIBUV_CFLAGS"
|
||||
LIBS="$LIBS $LIBUV_LIBS"
|
||||
|
||||
# Those functions are only provided in newer versions of libuv, we'll be emulating them
|
||||
# for now
|
||||
AC_CHECK_FUNCS([uv_handle_get_data uv_handle_set_data])
|
||||
AC_CHECK_FUNCS([uv_req_get_data uv_req_set_data])
|
||||
AC_CHECK_FUNCS([uv_udp_connect uv_translate_sys_error uv_sleep])
|
||||
AC_CHECK_FUNCS([uv_os_getenv uv_os_setenv])
|
||||
AX_RESTORE_FLAGS([libuv])
|
||||
|
||||
# libnghttp2
|
||||
AC_MSG_CHECKING([for libnghttp2])
|
||||
|
||||
@@ -578,7 +578,7 @@ udp_send_direct(isc_nmsocket_t *sock, isc__nm_uvreq_t *req,
|
||||
return (ISC_R_CANCELED);
|
||||
}
|
||||
|
||||
#ifdef HAVE_UV_UDP_CONNECT
|
||||
#if UV_VERSION_HEX >= UV_VERSION(1, 27, 0)
|
||||
/*
|
||||
* If we used uv_udp_connect() (and not the shim version for
|
||||
* older versions of libuv), then the peer address has to be
|
||||
|
||||
@@ -36,11 +36,11 @@ isc_uv_udp_connect(uv_udp_t *handle, const struct sockaddr *addr) {
|
||||
#ifdef WIN32
|
||||
return (uv_translate_sys_error(err));
|
||||
#else /* WIN32 */
|
||||
#ifdef HAVE_UV_TRANSLATE_SYS_ERROR
|
||||
#if UV_VERSION_HEX >= UV_VERSION(1, 10, 0)
|
||||
return (uv_translate_sys_error(errno));
|
||||
#else
|
||||
return (-errno);
|
||||
#endif /* HAVE_UV_TRANSLATE_SYS_ERROR */
|
||||
#endif /* UV_VERSION_HEX >= UV_VERSION(1, 10, 0) */
|
||||
#endif /* WIN32 */
|
||||
}
|
||||
|
||||
|
||||
@@ -694,7 +694,7 @@ mock_udpconnect_uv_udp_bind(void **state __attribute__((unused))) {
|
||||
RESET_RETURN;
|
||||
}
|
||||
|
||||
#if HAVE_UV_UDP_CONNECT
|
||||
#if UV_VERSION_HEX >= UV_VERSION(1, 27, 0)
|
||||
static void
|
||||
mock_udpconnect_uv_udp_connect(void **state __attribute__((unused))) {
|
||||
WILL_RETURN(uv_udp_connect, UV_ENOMEM);
|
||||
@@ -2730,7 +2730,7 @@ main(void) {
|
||||
nm_setup, nm_teardown),
|
||||
cmocka_unit_test_setup_teardown(mock_udpconnect_uv_udp_bind,
|
||||
nm_setup, nm_teardown),
|
||||
#if HAVE_UV_UDP_CONNECT
|
||||
#if UV_VERSION_HEX >= UV_VERSION(1, 27, 0)
|
||||
cmocka_unit_test_setup_teardown(mock_udpconnect_uv_udp_connect,
|
||||
nm_setup, nm_teardown),
|
||||
#endif
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
#define UNIT_TESTING
|
||||
#include <cmocka.h>
|
||||
|
||||
#include "../netmgr/uv-compat.h"
|
||||
|
||||
/* uv_udp_t */
|
||||
|
||||
int
|
||||
@@ -33,13 +35,13 @@ __wrap_uv_udp_open(uv_udp_t *handle, uv_os_sock_t sock);
|
||||
int
|
||||
__wrap_uv_udp_bind(uv_udp_t *handle, const struct sockaddr *addr,
|
||||
unsigned int flags);
|
||||
#if HAVE_UV_UDP_CONNECT
|
||||
#if UV_VERSION_HEX >= UV_VERSION(1, 27, 0)
|
||||
int
|
||||
__wrap_uv_udp_connect(uv_udp_t *handle, const struct sockaddr *addr);
|
||||
int
|
||||
__wrap_uv_udp_getpeername(const uv_udp_t *handle, struct sockaddr *name,
|
||||
int *namelen);
|
||||
#endif /* HAVE_UV_UDP_CONNECT */
|
||||
#endif /* UV_VERSION_HEX >= UV_VERSION(1, 27, 0) */
|
||||
int
|
||||
__wrap_uv_udp_getsockname(const uv_udp_t *handle, struct sockaddr *name,
|
||||
int *namelen);
|
||||
@@ -114,7 +116,7 @@ __wrap_uv_udp_bind(uv_udp_t *handle, const struct sockaddr *addr,
|
||||
static atomic_int __state_uv_udp_connect
|
||||
__attribute__((unused)) = ATOMIC_VAR_INIT(0);
|
||||
|
||||
#if HAVE_UV_UDP_CONNECT
|
||||
#if UV_VERSION_HEX >= UV_VERSION(1, 27, 0)
|
||||
int
|
||||
__wrap_uv_udp_connect(uv_udp_t *handle, const struct sockaddr *addr) {
|
||||
if (atomic_load(&__state_uv_udp_connect) == 0) {
|
||||
@@ -122,12 +124,12 @@ __wrap_uv_udp_connect(uv_udp_t *handle, const struct sockaddr *addr) {
|
||||
}
|
||||
return (atomic_load(&__state_uv_udp_connect));
|
||||
}
|
||||
#endif /* HAVE_UV_UDP_CONNECT */
|
||||
#endif /* UV_VERSION_HEX >= UV_VERSION(1, 27, 0) */
|
||||
|
||||
static atomic_int __state_uv_udp_getpeername
|
||||
__attribute__((unused)) = ATOMIC_VAR_INIT(0);
|
||||
|
||||
#if HAVE_UV_UDP_CONNECT
|
||||
#if UV_VERSION_HEX >= UV_VERSION(1, 27, 0)
|
||||
int
|
||||
__wrap_uv_udp_getpeername(const uv_udp_t *handle, struct sockaddr *name,
|
||||
int *namelen) {
|
||||
@@ -136,7 +138,7 @@ __wrap_uv_udp_getpeername(const uv_udp_t *handle, struct sockaddr *name,
|
||||
}
|
||||
return (atomic_load(&__state_uv_udp_getpeername));
|
||||
}
|
||||
#endif /* HAVE_UV_UDP_CONNECT */
|
||||
#endif /* UV_VERSION_HEX >= UV_VERSION(1, 27, 0) */
|
||||
|
||||
static atomic_int __state_uv_udp_getsockname = ATOMIC_VAR_INIT(0);
|
||||
int
|
||||
@@ -274,10 +276,10 @@ __wrap_uv_fileno(const uv_handle_t *handle, uv_os_fd_t *fd) {
|
||||
|
||||
#define uv_udp_open(...) __wrap_uv_udp_open(__VA_ARGS__)
|
||||
#define uv_udp_bind(...) __wrap_uv_udp_bind(__VA_ARGS__)
|
||||
#if HAVE_UV_UDP_CONNECT
|
||||
#if UV_VERSION_HEX >= UV_VERSION(1, 27, 0)
|
||||
#define uv_udp_connect(...) __wrap_uv_udp_connect(__VA_ARGS__)
|
||||
#define uv_udp_getpeername(...) __wrap_uv_udp_getpeername(__VA_ARGS__)
|
||||
#endif /* HAVE_UV_UDP_CONNECT */
|
||||
#endif /* UV_VERSION_HEX >= UV_VERSION(1, 27, 0) */
|
||||
#define uv_udp_getsockname(...) __wrap_uv_udp_getsockname(__VA_ARGS__)
|
||||
#define uv_udp_send(...) __wrap_uv_udp_send(__VA_ARGS__)
|
||||
#define uv_udp_recv_start(...) __wrap_uv_udp_recv_start(__VA_ARGS__)
|
||||
|
||||
Reference in New Issue
Block a user