diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-06-09 22:01:41 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-06-09 22:01:41 +0000 |
commit | c9f75566447fd3a9c5c304dbc8e31fd68b6aa3ed (patch) | |
tree | 3966560120dc3abbd2bd20983ccf95bc25b731d1 /src/util/test_resolver_api.c | |
parent | bc6a7f8d6cfbfc92128d1e6c495ee94c5508e26f (diff) | |
download | gnunet-c9f75566447fd3a9c5c304dbc8e31fd68b6aa3ed.tar.gz gnunet-c9f75566447fd3a9c5c304dbc8e31fd68b6aa3ed.zip |
-fix timeout handling for resolver
Diffstat (limited to 'src/util/test_resolver_api.c')
-rw-r--r-- | src/util/test_resolver_api.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/util/test_resolver_api.c b/src/util/test_resolver_api.c index 77dae50d2..f959fab77 100644 --- a/src/util/test_resolver_api.c +++ b/src/util/test_resolver_api.c | |||
@@ -27,6 +27,9 @@ | |||
27 | #include "resolver.h" | 27 | #include "resolver.h" |
28 | 28 | ||
29 | 29 | ||
30 | static int disable_rootserver_check; | ||
31 | |||
32 | |||
30 | /** | 33 | /** |
31 | * Using DNS root servers to check gnunet's resolver service | 34 | * Using DNS root servers to check gnunet's resolver service |
32 | * a.root-servers.net <-> 198.41.0.4 is a fix 1:1 mapping that should not change over years | 35 | * a.root-servers.net <-> 198.41.0.4 is a fix 1:1 mapping that should not change over years |
@@ -198,7 +201,8 @@ check_rootserver_ip (void *cls, const struct sockaddr *sa, socklen_t salen) | |||
198 | 201 | ||
199 | 202 | ||
200 | static void | 203 | static void |
201 | check_rootserver_name (void *cls, const char *hostname) | 204 | check_rootserver_name (void *cls, |
205 | const char *hostname) | ||
202 | { | 206 | { |
203 | int *ok = cls; | 207 | int *ok = cls; |
204 | 208 | ||
@@ -214,11 +218,11 @@ check_rootserver_name (void *cls, const char *hostname) | |||
214 | } | 218 | } |
215 | else | 219 | else |
216 | { | 220 | { |
217 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 221 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
218 | "Received invalid rootserver hostname `%s', expected `%s'\n", | 222 | "Received invalid rootserver hostname `%s', expected `%s'\n", |
219 | hostname, | 223 | hostname, |
220 | ROOTSERVER_NAME); | 224 | ROOTSERVER_NAME); |
221 | GNUNET_break (0); | 225 | GNUNET_break (disable_rootserver_check); |
222 | } | 226 | } |
223 | } | 227 | } |
224 | 228 | ||
@@ -271,7 +275,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
271 | } | 275 | } |
272 | 276 | ||
273 | /* Counting returned IP addresses */ | 277 | /* Counting returned IP addresses */ |
274 | while (rootserver->h_addr_list[count_ips] != NULL) | 278 | while (NULL != rootserver->h_addr_list[count_ips]) |
275 | count_ips++; | 279 | count_ips++; |
276 | if (count_ips > 1) | 280 | if (count_ips > 1) |
277 | { | 281 | { |
@@ -315,18 +319,19 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
315 | if (NULL == rootserver) | 319 | if (NULL == rootserver) |
316 | { | 320 | { |
317 | /* Error: resolving IP addresses does not work */ | 321 | /* Error: resolving IP addresses does not work */ |
318 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 322 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
319 | "gethostbyaddr() could not lookup hostname: %s\n", | 323 | "gethostbyaddr() could not lookup hostname: %s\n", |
320 | hstrerror (h_errno)); | 324 | hstrerror (h_errno)); |
321 | GNUNET_break (0); | 325 | disable_rootserver_check = GNUNET_YES; |
322 | } | 326 | } |
323 | else | 327 | else |
324 | { | 328 | { |
325 | if (0 != strcmp (rootserver->h_name, ROOTSERVER_NAME)) | 329 | if (0 != strcmp (rootserver->h_name, |
330 | ROOTSERVER_NAME)) | ||
326 | { | 331 | { |
327 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 332 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
328 | "Received hostname and hostname for root name server differ\n"); | 333 | "Received hostname and hostname for root name server differ\n"); |
329 | GNUNET_break (0); | 334 | disable_rootserver_check = GNUNET_YES; |
330 | } | 335 | } |
331 | } | 336 | } |
332 | 337 | ||