summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2006-11-28 01:54:16 +0000
committerStef Walter <stef@memberwebs.com>2006-11-28 01:54:16 +0000
commit87521fc8eff52fc4bc3bbb5a0ac80d81634bc1e0 (patch)
treefd82bb8bf0df95120247d2858ff53ffb05e21215 /common
parentfafb8142821a34311f55971674630b674b063495 (diff)
Fixed asynchronous resolving on FreeBSD
Diffstat (limited to 'common')
-rw-r--r--common/async-resolver.c8
-rw-r--r--common/async-resolver.h2
2 files changed, 7 insertions, 3 deletions
diff --git a/common/async-resolver.c b/common/async-resolver.c
index cf92c86..284a486 100644
--- a/common/async-resolver.c
+++ b/common/async-resolver.c
@@ -109,6 +109,7 @@ typedef struct _resolve_request
{
char hostname[256];
char servname[256];
+ struct addrinfo hints;
async_resolve_callback cb;
void *arg;
@@ -164,7 +165,7 @@ resolver_thread(void* arg)
/* The actual resolve */
req->gaierr = getaddrinfo(req->hostname, req->servname[0] ? req->servname : NULL,
- NULL, &req->ai);
+ &req->hints, &req->ai);
req->errn = errno;
/* A timeout */
@@ -255,7 +256,7 @@ async_resolver_init()
void
async_resolver_queue(const char* hostname, const char* servname,
- async_resolve_callback cb, void* arg)
+ struct addrinfo* hints, async_resolve_callback cb, void* arg)
{
resolve_request* req;
resolve_request* r;
@@ -287,6 +288,9 @@ async_resolver_queue(const char* hostname, const char* servname,
strncpy(req->servname, servname, sizeof(req->servname));
req->servname[sizeof(req->servname) - 1] = 0;
+ if(hints)
+ memcpy(&(req->hints), hints, sizeof(req->hints));
+
/* Append the result to requests */
pthread_mutex_lock(&res_mutex);
diff --git a/common/async-resolver.h b/common/async-resolver.h
index bc17735..a3be364 100644
--- a/common/async-resolver.h
+++ b/common/async-resolver.h
@@ -42,7 +42,7 @@ int async_resolver_init();
void async_resolver_uninit();
void async_resolver_queue(const char* hostname, const char* servname,
- async_resolve_callback cb, void* arg);
+ struct addrinfo* hints, async_resolve_callback cb, void* arg);
#endif /* __ASYNC_RESOLVER_H__ */