Commit 6ce589c3 authored by Steinar H. Gunderson's avatar Steinar H. Gunderson
Browse files

Make the query callbacks return the number of timeouts that happened during...

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.)
parent d426c20c
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -127,7 +127,8 @@ static const char *rcodes[] = {
  "(unknown)", "(unknown)", "(unknown)", "(unknown)", "NOCHANGE"
};

static void callback(void *arg, int status, unsigned char *abuf, int alen);
static void callback(void *arg, int status, int timeouts,
                     unsigned char *abuf, int alen);
static const unsigned char *display_question(const unsigned char *aptr,
                                             const unsigned char *abuf,
                                             int alen);
@@ -294,7 +295,8 @@ int main(int argc, char **argv)
  return 0;
}

static void callback(void *arg, int status, unsigned char *abuf, int alen)
static void callback(void *arg, int status, int timeouts,
                     unsigned char *abuf, int alen)
{
  char *name = (char *) arg;
  int id, qr, opcode, aa, tc, rd, ra, rcode;
+2 −2
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ struct in6_addr
};
#endif

static void callback(void *arg, int status, struct hostent *host);
static void callback(void *arg, int status, int timeouts, struct hostent *host);
static void usage(void);

int main(int argc, char **argv)
@@ -142,7 +142,7 @@ int main(int argc, char **argv)
  return 0;
}

static void callback(void *arg, int status, struct hostent *host)
static void callback(void *arg, int status, int timeouts, struct hostent *host)
{
  char **p;

+4 −4
Original line number Diff line number Diff line
@@ -193,11 +193,11 @@ struct timeval;
struct sockaddr;
struct ares_channeldata;
typedef struct ares_channeldata *ares_channel;
typedef void (*ares_callback)(void *arg, int status, unsigned char *abuf,
                              int alen);
typedef void (*ares_host_callback)(void *arg, int status,
typedef void (*ares_callback)(void *arg, int status, int timeouts,
                              unsigned char *abuf, int alen);
typedef void (*ares_host_callback)(void *arg, int status, int timeouts,
                                   struct hostent *hostent);
typedef void (*ares_nameinfo_callback)(void *arg, int status,
typedef void (*ares_nameinfo_callback)(void *arg, int status, int timeouts,
                                       char *node, char *service);

int ares_init(ares_channel *channelptr);
+1 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ void ares_cancel(ares_channel channel)
  for (query = channel->queries; query; query = next)
  {
    next = query->next;
    query->callback(query->arg, ARES_ETIMEOUT, NULL, 0);
    query->callback(query->arg, ARES_ETIMEOUT, 0, NULL, 0);
    free(query->tcpbuf);
    free(query->server_info);
    free(query);
+1 −1
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ void ares_destroy(ares_channel channel)
  while (channel->queries) {
    query = channel->queries;
    channel->queries = query->next;
    query->callback(query->arg, ARES_EDESTRUCTION, NULL, 0);
    query->callback(query->arg, ARES_EDESTRUCTION, 0, NULL, 0);
    if (query->tcpbuf)
      free(query->tcpbuf);
    if (query->server_info)
Loading