summaryrefslogtreecommitdiff
path: root/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
commit50ba81cd230f9054fa7c45cb4202ce8720c502b3 (patch)
tree277c02b995aacc09540ec58270e10cd1845ff2b3 /ares_query.c
parentb669e17544c0ff64d120b8a0df2677c59ccea8fd (diff)
downloadc-ares-50ba81cd230f9054fa7c45cb4202ce8720c502b3.tar.gz
c-ares-50ba81cd230f9054fa7c45cb4202ce8720c502b3.tar.bz2
c-ares-50ba81cd230f9054fa7c45cb4202ce8720c502b3.zip
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_query.c')
-rw-r--r--ares_query.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/ares_query.c b/ares_query.c
index 0cd6557..c5fc124 100644
--- a/ares_query.c
+++ b/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);
}