From: Matthias Wachs Date: Thu, 14 Jul 2011 09:16:17 +0000 (+0000) Subject: return ip address for timed out reverse lookups X-Git-Tag: initial-import-from-subversion-38251~17886 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;ds=sidebyside;h=6e079c87aff0e8e705f5530a0ca71c831b9a93b2;p=oweals%2Fgnunet.git return ip address for timed out reverse lookups --- diff --git a/src/util/resolver_api.c b/src/util/resolver_api.c index f8f6cde29..7d59f673a 100644 --- a/src/util/resolver_api.c +++ b/src/util/resolver_api.c @@ -152,6 +152,11 @@ struct GNUNET_RESOLVER_RequestHandle */ int direction; + /** + * GNUNET_YES if a response was received + */ + int received_response; + /** * Length of the data that follows this struct. */ @@ -361,7 +366,13 @@ handle_response (void *cls, if (rh->was_transmitted != GNUNET_SYSERR) { if (NULL != rh->name_callback) - rh->name_callback (rh->cls, NULL); + { + if (rh->received_response == GNUNET_NO) + rh->name_callback (rh->cls, + no_resolve ((const struct sockaddr *) &rh[1], rh->data_len)); + else + rh->name_callback (rh->cls, NULL); + } if (NULL != rh->addr_callback) rh->addr_callback (rh->cls, NULL, 0); } @@ -388,7 +399,7 @@ handle_response (void *cls, if (rh->was_transmitted != GNUNET_SYSERR) { if (NULL != rh->name_callback) - rh->name_callback (rh->cls, NULL); + rh->name_callback (rh->cls, NULL); if (NULL != rh->addr_callback) rh->addr_callback (rh->cls, NULL, 0); } @@ -424,6 +435,7 @@ handle_response (void *cls, #endif if (rh->was_transmitted != GNUNET_SYSERR) rh->name_callback (rh->cls, hostname); + rh->received_response = GNUNET_YES; GNUNET_CLIENT_receive (client, &handle_response, rh, @@ -843,6 +855,7 @@ GNUNET_RESOLVER_hostname_get (const struct sockaddr *sa, memcpy (&rh[1], sa, salen); rh->data_len = salen; rh->direction = GNUNET_YES; + rh->received_response = GNUNET_NO; if (GNUNET_NO == do_resolve) { rh->task = GNUNET_SCHEDULER_add_now (&numeric_reverse, rh);