diff --git a/test/benchmark-ares.c b/test/benchmark-ares.c index ff384805..6766b780 100644 --- a/test/benchmark-ares.c +++ b/test/benchmark-ares.c @@ -56,17 +56,13 @@ static void aresbynamecallback( void *arg, static void prep_tcploopback() { + /* for test, use echo server - TCP port TEST_PORT on loopback */ + struct sockaddr_in test_server = uv_ip4_addr("127.0.0.1", 0); int rc = 0; optmask = 0; - /* for test, use echo server - TCP port TEST_PORT on loopback */ - testsrv.S_un.S_un_b.s_b1 = 127; - testsrv.S_un.S_un_b.s_b2 = 0; - testsrv.S_un.S_un_b.s_b3 = 0; - testsrv.S_un.S_un_b.s_b4 = 1; - optmask = ARES_OPT_SERVERS | ARES_OPT_TCP_PORT | ARES_OPT_FLAGS; - options.servers = &testsrv; + options.servers = &test_server.sin_addr; options.nservers = 1; options.tcp_port = htons(TEST_PORT_2); options.flags = ARES_FLAG_USEVC; @@ -114,7 +110,7 @@ BENCHMARK_IMPL(gethostbyname) { if (ares_errors > 0) { printf("There were %d failures\n", ares_errors); } - LOGF("ares_gethostbyname: %d calls in %ld ms \n", ares_callbacks, (end_time - start_time)); + LOGF("ares_gethostbyname: %d calls in %d ms \n", ares_callbacks, (int) (end_time - start_time)); return 0; } diff --git a/test/dns-server.c b/test/dns-server.c index c0e486b9..0da18801 100644 --- a/test/dns-server.c +++ b/test/dns-server.c @@ -23,6 +23,7 @@ #include "task.h" #include #include +#include typedef struct { diff --git a/test/test-gethostbyname.c b/test/test-gethostbyname.c index 1b963dd5..41ee766b 100644 --- a/test/test-gethostbyname.c +++ b/test/test-gethostbyname.c @@ -30,8 +30,6 @@ ares_channel channel; struct ares_options options; int optmask; -struct in_addr testsrv; - int ares_bynamecallbacks; int bynamecallbacksig; int ares_byaddrcallbacks; @@ -72,15 +70,12 @@ static void aresbyaddrcallback( void *arg, static void prep_tcploopback() { - int rc = 0; /* for test, use echo server - TCP port TEST_PORT on loopback */ - testsrv.S_un.S_un_b.s_b1 = 127; - testsrv.S_un.S_un_b.s_b2 = 0; - testsrv.S_un.S_un_b.s_b3 = 0; - testsrv.S_un.S_un_b.s_b4 = 1; + struct sockaddr_in test_server = uv_ip4_addr("127.0.0.1", 0); + int rc; optmask = ARES_OPT_SERVERS | ARES_OPT_TCP_PORT | ARES_OPT_FLAGS; - options.servers = &testsrv; + options.servers = &test_server.sin_addr; options.nservers = 1; options.tcp_port = htons(TEST_PORT); options.flags = ARES_FLAG_USEVC; diff --git a/uv-unix.c b/uv-unix.c index 91ed1274..e604721b 100644 --- a/uv-unix.c +++ b/uv-unix.c @@ -1294,8 +1294,9 @@ int64_t uv_timer_get_repeat(uv_timer_t* timer) { int uv_ares_init_options(ares_channel *channelptr, struct ares_options *options, int optmask) { - rc = ares_init_options(channelptr, options, optmask); - return rc; + int r; + r = ares_init_options(channelptr, options, optmask); + return r; } void uv_ares_destroy(ares_channel channel) { @@ -1303,21 +1304,12 @@ void uv_ares_destroy(ares_channel channel) { } -/* temporary implementation of uv_getaddrinfo -* calls getaddrinfo, then invokes callback and frees addrinfo -*/ -void uv_getaddrinfo(uv_getaddrinfo_t* handle, - uv_getaddrinfo_cb getaddrinfo_cb, - char* node, - char* service, - struct addrinfo* hints) { - int ret; - struct addrinfo* res = NULL; - ret = getaddrinfo(getaddrinfo_cb, node, service, hints, &res); - - /* call user with results */ - (*getaddrinfo_cb)(handle, uv_translate_sys_error(ret), res); - if (ret == 0) { - freeaddrinfo(res); - } +/* stub implementation of uv_getaddrinfo */ +int uv_getaddrinfo(uv_getaddrinfo_t* handle, + uv_getaddrinfo_cb getaddrinfo_cb, + const char* node, + const char* service, + const struct addrinfo* hints) { + return -1; } + diff --git a/uv-unix.h b/uv-unix.h index 234059ae..13305abb 100644 --- a/uv-unix.h +++ b/uv-unix.h @@ -26,7 +26,9 @@ #include "ev/ev.h" +#include #include +#include #include #include