aboutsummaryrefslogtreecommitdiff
path: root/ares/ares_query.c
diff options
context:
space:
mode:
authorSteinar H. Gunderson <sesse@google.com>2007-09-28 14:46:51 +0000
committerSteinar H. Gunderson <sesse@google.com>2007-09-28 14:46:51 +0000
commit6ce589c3ee1b905d22d419531e8e2019134e833b (patch)
treeeb557ed81d38a2339ca2cb6069b8973c93f18e17 /ares/ares_query.c
parentd426c20c0a71df7db7a8bae18c91034df502070a (diff)
Make the query callbacks return the number of timeouts that happened during the execution of a query, and update documentation accordingly. (Patch from the Google tree.)
Diffstat (limited to 'ares/ares_query.c')
-rw-r--r--ares/ares_query.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/ares/ares_query.c b/ares/ares_query.c
index 0cd655709..c5fc12449 100644
--- a/ares/ares_query.c
+++ b/ares/ares_query.c
@@ -37,7 +37,7 @@ struct qquery {
void *arg;
};
-static void qcallback(void *arg, int status, unsigned char *abuf, int alen);
+static void qcallback(void *arg, int status, int timeouts, unsigned char *abuf, int alen);
void ares__rc4(rc4_key* key, unsigned char *buffer_ptr, int buffer_len)
{
@@ -110,7 +110,8 @@ void ares_query(ares_channel channel, const char *name, int dnsclass,
&qlen);
if (status != ARES_SUCCESS)
{
- callback(arg, status, NULL, 0);
+ if (qbuf != NULL) free(qbuf);
+ callback(arg, status, 0, NULL, 0);
return;
}
@@ -121,7 +122,7 @@ void ares_query(ares_channel channel, const char *name, int dnsclass,
if (!qquery)
{
ares_free_string(qbuf);
- callback(arg, ARES_ENOMEM, NULL, 0);
+ callback(arg, ARES_ENOMEM, 0, NULL, 0);
return;
}
qquery->callback = callback;
@@ -132,14 +133,14 @@ void ares_query(ares_channel channel, const char *name, int dnsclass,
ares_free_string(qbuf);
}
-static void qcallback(void *arg, int status, unsigned char *abuf, int alen)
+static void qcallback(void *arg, int status, int timeouts, unsigned char *abuf, int alen)
{
struct qquery *qquery = (struct qquery *) arg;
unsigned int ancount;
int rcode;
if (status != ARES_SUCCESS)
- qquery->callback(qquery->arg, status, abuf, alen);
+ qquery->callback(qquery->arg, status, timeouts, abuf, alen);
else
{
/* Pull the response code and answer count from the packet. */
@@ -168,7 +169,7 @@ static void qcallback(void *arg, int status, unsigned char *abuf, int alen)
status = ARES_EREFUSED;
break;
}
- qquery->callback(qquery->arg, status, abuf, alen);
+ qquery->callback(qquery->arg, status, timeouts, abuf, alen);
}
free(qquery);
}