Un-break the unix build

This commit is contained in:
Bert Belder 2011-06-25 17:35:59 +02:00
parent b0ea919254
commit 8801925b41
5 changed files with 21 additions and 35 deletions

View File

@ -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;
}

View File

@ -23,6 +23,7 @@
#include "task.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct {

View File

@ -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;

View File

@ -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;
}

View File

@ -26,7 +26,9 @@
#include "ev/ev.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/tcp.h>