"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/lib/ares_getaddrinfo.c" between
c-ares-1.17.1.tar.gz and c-ares-1.17.2.tar.gz

About: c-ares is a C library for asynchronous DNS requests (including name resolves).

ares_getaddrinfo.c  (c-ares-1.17.1):ares_getaddrinfo.c  (c-ares-1.17.2)
skipping to change at line 37 skipping to change at line 37
#ifdef HAVE_NETINET_IN_H #ifdef HAVE_NETINET_IN_H
# include <netinet/in.h> # include <netinet/in.h>
#endif #endif
#ifdef HAVE_NETDB_H #ifdef HAVE_NETDB_H
# include <netdb.h> # include <netdb.h>
#endif #endif
#ifdef HAVE_ARPA_INET_H #ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h> # include <arpa/inet.h>
#endif #endif
#ifdef HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h> #include "ares_nameser.h"
#else
# include "nameser.h"
#endif
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
# include <arpa/nameser_compat.h>
#endif
#ifdef HAVE_STRINGS_H #ifdef HAVE_STRINGS_H
#include <strings.h> #include <strings.h>
#endif #endif
#include <assert.h> #include <assert.h>
#ifdef HAVE_LIMITS_H #ifdef HAVE_LIMITS_H
#include <limits.h> #include <limits.h>
#endif #endif
skipping to change at line 402 skipping to change at line 396
callback(arg, ARES_SUCCESS, 0, ai); callback(arg, ARES_SUCCESS, 0, ai);
return 1; return 1;
} }
static void end_hquery(struct host_query *hquery, int status) static void end_hquery(struct host_query *hquery, int status)
{ {
struct ares_addrinfo_node sentinel; struct ares_addrinfo_node sentinel;
struct ares_addrinfo_node *next; struct ares_addrinfo_node *next;
if (status == ARES_SUCCESS) if (status == ARES_SUCCESS)
{ {
if (!(hquery->hints.ai_flags & ARES_AI_NOSORT)) if (!(hquery->hints.ai_flags & ARES_AI_NOSORT) && hquery->ai->nodes)
{ {
sentinel.ai_next = hquery->ai->nodes; sentinel.ai_next = hquery->ai->nodes;
ares__sortaddrinfo(hquery->channel, &sentinel); ares__sortaddrinfo(hquery->channel, &sentinel);
hquery->ai->nodes = sentinel.ai_next; hquery->ai->nodes = sentinel.ai_next;
} }
next = hquery->ai->nodes; next = hquery->ai->nodes;
/* Set port into each address (resolved separately). */ /* Set port into each address (resolved separately). */
while (next) while (next)
{ {
next->ai_socktype = hquery->hints.ai_socktype; next->ai_socktype = hquery->hints.ai_socktype;
skipping to change at line 553 skipping to change at line 547
{ {
struct host_query *hquery = (struct host_query*)arg; struct host_query *hquery = (struct host_query*)arg;
int addinfostatus = ARES_SUCCESS; int addinfostatus = ARES_SUCCESS;
hquery->timeouts += timeouts; hquery->timeouts += timeouts;
hquery->remaining--; hquery->remaining--;
if (status == ARES_SUCCESS) if (status == ARES_SUCCESS)
{ {
addinfostatus = ares__parse_into_addrinfo(abuf, alen, hquery->ai); addinfostatus = ares__parse_into_addrinfo(abuf, alen, hquery->ai);
} }
else if (status == ARES_EDESTRUCTION)
{
end_hquery(hquery, status);
return;
}
if (!hquery->remaining) if (!hquery->remaining)
{ {
if (addinfostatus != ARES_SUCCESS) if (addinfostatus != ARES_SUCCESS)
{ {
/* error in parsing result e.g. no memory */ /* error in parsing result e.g. no memory */
end_hquery(hquery, addinfostatus); end_hquery(hquery, addinfostatus);
} }
else if (hquery->ai->nodes) else if (hquery->ai->nodes)
{ {
/* at least one query ended with ARES_SUCCESS */ /* at least one query ended with ARES_SUCCESS */
end_hquery(hquery, ARES_SUCCESS); end_hquery(hquery, ARES_SUCCESS);
} }
else if (status == ARES_ENOTFOUND) else if (status == ARES_ENOTFOUND)
{ {
next_lookup(hquery, status); next_lookup(hquery, status);
} }
else if (status == ARES_EDESTRUCTION)
{
/* NOTE: Could also be ARES_EDESTRUCTION. We need to only call this
* once all queries (there can be multiple for getaddrinfo) are
* terminated. */
end_hquery(hquery, status);
}
else else
{ {
end_hquery(hquery, status); end_hquery(hquery, status);
} }
} }
/* at this point we keep on waiting for the next query to finish */ /* at this point we keep on waiting for the next query to finish */
} }
void ares_getaddrinfo(ares_channel channel, void ares_getaddrinfo(ares_channel channel,
 End of changes. 4 change blocks. 
14 lines changed or deleted 10 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)