diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2011-07-14 09:16:17 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2011-07-14 09:16:17 +0000 |
commit | 6e079c87aff0e8e705f5530a0ca71c831b9a93b2 (patch) | |
tree | 1e74b683b1b0a441542ad08f62efbd1f22f646c5 /src/util/resolver_api.c | |
parent | 1d9420ad0782bd03f19800ba34f50437707375a0 (diff) | |
download | gnunet-6e079c87aff0e8e705f5530a0ca71c831b9a93b2.tar.gz gnunet-6e079c87aff0e8e705f5530a0ca71c831b9a93b2.zip |
return ip address for timed out reverse lookups
Diffstat (limited to 'src/util/resolver_api.c')
-rw-r--r-- | src/util/resolver_api.c | 17 |
1 files changed, 15 insertions, 2 deletions
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 | |||
@@ -153,6 +153,11 @@ struct GNUNET_RESOLVER_RequestHandle | |||
153 | int direction; | 153 | int direction; |
154 | 154 | ||
155 | /** | 155 | /** |
156 | * GNUNET_YES if a response was received | ||
157 | */ | ||
158 | int received_response; | ||
159 | |||
160 | /** | ||
156 | * Length of the data that follows this struct. | 161 | * Length of the data that follows this struct. |
157 | */ | 162 | */ |
158 | size_t data_len; | 163 | size_t data_len; |
@@ -361,7 +366,13 @@ handle_response (void *cls, | |||
361 | if (rh->was_transmitted != GNUNET_SYSERR) | 366 | if (rh->was_transmitted != GNUNET_SYSERR) |
362 | { | 367 | { |
363 | if (NULL != rh->name_callback) | 368 | if (NULL != rh->name_callback) |
364 | rh->name_callback (rh->cls, NULL); | 369 | { |
370 | if (rh->received_response == GNUNET_NO) | ||
371 | rh->name_callback (rh->cls, | ||
372 | no_resolve ((const struct sockaddr *) &rh[1], rh->data_len)); | ||
373 | else | ||
374 | rh->name_callback (rh->cls, NULL); | ||
375 | } | ||
365 | if (NULL != rh->addr_callback) | 376 | if (NULL != rh->addr_callback) |
366 | rh->addr_callback (rh->cls, NULL, 0); | 377 | rh->addr_callback (rh->cls, NULL, 0); |
367 | } | 378 | } |
@@ -388,7 +399,7 @@ handle_response (void *cls, | |||
388 | if (rh->was_transmitted != GNUNET_SYSERR) | 399 | if (rh->was_transmitted != GNUNET_SYSERR) |
389 | { | 400 | { |
390 | if (NULL != rh->name_callback) | 401 | if (NULL != rh->name_callback) |
391 | rh->name_callback (rh->cls, NULL); | 402 | rh->name_callback (rh->cls, NULL); |
392 | if (NULL != rh->addr_callback) | 403 | if (NULL != rh->addr_callback) |
393 | rh->addr_callback (rh->cls, NULL, 0); | 404 | rh->addr_callback (rh->cls, NULL, 0); |
394 | } | 405 | } |
@@ -424,6 +435,7 @@ handle_response (void *cls, | |||
424 | #endif | 435 | #endif |
425 | if (rh->was_transmitted != GNUNET_SYSERR) | 436 | if (rh->was_transmitted != GNUNET_SYSERR) |
426 | rh->name_callback (rh->cls, hostname); | 437 | rh->name_callback (rh->cls, hostname); |
438 | rh->received_response = GNUNET_YES; | ||
427 | GNUNET_CLIENT_receive (client, | 439 | GNUNET_CLIENT_receive (client, |
428 | &handle_response, | 440 | &handle_response, |
429 | rh, | 441 | rh, |
@@ -843,6 +855,7 @@ GNUNET_RESOLVER_hostname_get (const struct sockaddr *sa, | |||
843 | memcpy (&rh[1], sa, salen); | 855 | memcpy (&rh[1], sa, salen); |
844 | rh->data_len = salen; | 856 | rh->data_len = salen; |
845 | rh->direction = GNUNET_YES; | 857 | rh->direction = GNUNET_YES; |
858 | rh->received_response = GNUNET_NO; | ||
846 | if (GNUNET_NO == do_resolve) | 859 | if (GNUNET_NO == do_resolve) |
847 | { | 860 | { |
848 | rh->task = GNUNET_SCHEDULER_add_now (&numeric_reverse, rh); | 861 | rh->task = GNUNET_SCHEDULER_add_now (&numeric_reverse, rh); |