aboutsummaryrefslogtreecommitdiff
path: root/src/util/resolver_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-05-06 01:12:57 +0000
committerChristian Grothoff <christian@grothoff.org>2012-05-06 01:12:57 +0000
commit9fac6b6eefdc9144053f736fd388cb2199a97046 (patch)
tree82740a981b7f6ae973d915aa77797acd9db668b2 /src/util/resolver_api.c
parent23d8d343d5c70481ecf78ec4fafc698907f3e8a9 (diff)
downloadgnunet-9fac6b6eefdc9144053f736fd388cb2199a97046.tar.gz
gnunet-9fac6b6eefdc9144053f736fd388cb2199a97046.zip
-removing legacy ifdefs, fixing log statements
Diffstat (limited to 'src/util/resolver_api.c')
-rw-r--r--src/util/resolver_api.c26
1 files changed, 4 insertions, 22 deletions
diff --git a/src/util/resolver_api.c b/src/util/resolver_api.c
index ab0574efa..87b76f12d 100644
--- a/src/util/resolver_api.c
+++ b/src/util/resolver_api.c
@@ -250,9 +250,7 @@ GNUNET_RESOLVER_disconnect ()
250 GNUNET_assert (NULL == req_tail); 250 GNUNET_assert (NULL == req_tail);
251 if (NULL != client) 251 if (NULL != client)
252 { 252 {
253#if DEBUG_RESOLVER
254 LOG (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from DNS service\n"); 253 LOG (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from DNS service\n");
255#endif
256 GNUNET_CLIENT_disconnect (client); 254 GNUNET_CLIENT_disconnect (client);
257 client = NULL; 255 client = NULL;
258 } 256 }
@@ -339,9 +337,7 @@ handle_response (void *cls, const struct GNUNET_MessageHeader *msg)
339 struct GNUNET_RESOLVER_RequestHandle *rh = cls; 337 struct GNUNET_RESOLVER_RequestHandle *rh = cls;
340 uint16_t size; 338 uint16_t size;
341 339
342#if DEBUG_RESOLVER
343 LOG (GNUNET_ERROR_TYPE_DEBUG, "Receiving response from DNS service\n"); 340 LOG (GNUNET_ERROR_TYPE_DEBUG, "Receiving response from DNS service\n");
344#endif
345 if (msg == NULL) 341 if (msg == NULL)
346 { 342 {
347 char buf[INET6_ADDRSTRLEN]; 343 char buf[INET6_ADDRSTRLEN];
@@ -422,10 +418,8 @@ handle_response (void *cls, const struct GNUNET_MessageHeader *msg)
422 reconnect (); 418 reconnect ();
423 return; 419 return;
424 } 420 }
425#if DEBUG_RESOLVER 421 LOG (GNUNET_ERROR_TYPE_DEBUG, "Resolver returns `%s' for IP `%s'.\n",
426 LOG (GNUNET_ERROR_TYPE_DEBUG, _("Resolver returns `%s' for IP `%s'.\n"),
427 hostname, GNUNET_a2s ((const void *) &rh[1], rh->data_len)); 422 hostname, GNUNET_a2s ((const void *) &rh[1], rh->data_len));
428#endif
429 if (rh->was_transmitted != GNUNET_SYSERR) 423 if (rh->was_transmitted != GNUNET_SYSERR)
430 rh->name_callback (rh->cls, hostname); 424 rh->name_callback (rh->cls, hostname);
431 rh->received_response = GNUNET_YES; 425 rh->received_response = GNUNET_YES;
@@ -633,10 +627,8 @@ process_requests ()
633 msg->direction = htonl (rh->direction); 627 msg->direction = htonl (rh->direction);
634 msg->af = htonl (rh->af); 628 msg->af = htonl (rh->af);
635 memcpy (&msg[1], &rh[1], rh->data_len); 629 memcpy (&msg[1], &rh[1], rh->data_len);
636#if DEBUG_RESOLVER
637 LOG (GNUNET_ERROR_TYPE_DEBUG, 630 LOG (GNUNET_ERROR_TYPE_DEBUG,
638 "Transmitting DNS resolution request to DNS service\n"); 631 "Transmitting DNS resolution request to DNS service\n");
639#endif
640 if (GNUNET_OK != 632 if (GNUNET_OK !=
641 GNUNET_CLIENT_transmit_and_get_response (client, &msg->header, 633 GNUNET_CLIENT_transmit_and_get_response (client, &msg->header,
642 GNUNET_TIME_absolute_get_remaining 634 GNUNET_TIME_absolute_get_remaining
@@ -666,9 +658,7 @@ reconnect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
666 return; /* no work pending */ 658 return; /* no work pending */
667 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 659 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
668 return; 660 return;
669#if DEBUG_RESOLVER
670 LOG (GNUNET_ERROR_TYPE_DEBUG, "Trying to connect to DNS service\n"); 661 LOG (GNUNET_ERROR_TYPE_DEBUG, "Trying to connect to DNS service\n");
671#endif
672 client = GNUNET_CLIENT_connect ("resolver", resolver_cfg); 662 client = GNUNET_CLIENT_connect ("resolver", resolver_cfg);
673 if (NULL == client) 663 if (NULL == client)
674 { 664 {
@@ -712,11 +702,9 @@ reconnect ()
712 break; 702 break;
713 } 703 }
714 } 704 }
715#if DEBUG_RESOLVER
716 LOG (GNUNET_ERROR_TYPE_DEBUG, 705 LOG (GNUNET_ERROR_TYPE_DEBUG,
717 "Will try to connect to DNS service in %llu ms\n", 706 "Will try to connect to DNS service in %llu ms\n",
718 (unsigned long long) backoff.rel_value); 707 (unsigned long long) backoff.rel_value);
719#endif
720 GNUNET_assert (NULL != resolver_cfg); 708 GNUNET_assert (NULL != resolver_cfg);
721 r_task = GNUNET_SCHEDULER_add_delayed (backoff, &reconnect_task, NULL); 709 r_task = GNUNET_SCHEDULER_add_delayed (backoff, &reconnect_task, NULL);
722 backoff = GNUNET_TIME_relative_multiply (backoff, 2); 710 backoff = GNUNET_TIME_relative_multiply (backoff, 2);
@@ -803,9 +791,7 @@ numeric_reverse (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
803 char *result; 791 char *result;
804 792
805 result = no_resolve (rh->af, &rh[1], rh->data_len); 793 result = no_resolve (rh->af, &rh[1], rh->data_len);
806#if DEBUG_RESOLVER 794 LOG (GNUNET_ERROR_TYPE_DEBUG, "Resolver returns `%s'.\n", result);
807 LOG (GNUNET_ERROR_TYPE_DEBUG, _("Resolver returns `%s'.\n"), result);
808#endif
809 if (result != NULL) 795 if (result != NULL)
810 { 796 {
811 rh->name_callback (rh->cls, result); 797 rh->name_callback (rh->cls, result);
@@ -897,9 +883,7 @@ GNUNET_RESOLVER_local_fqdn_get ()
897 "gethostname"); 883 "gethostname");
898 return NULL; 884 return NULL;
899 } 885 }
900#if DEBUG_RESOLVER 886 LOG (GNUNET_ERROR_TYPE_DEBUG, "Resolving our FQDN `%s'\n", hostname);
901 LOG (GNUNET_ERROR_TYPE_DEBUG, _("Resolving our FQDN `%s'\n"), hostname);
902#endif
903 host = gethostbyname (hostname); 887 host = gethostbyname (hostname);
904 if (NULL == host) 888 if (NULL == host)
905 { 889 {
@@ -934,9 +918,7 @@ GNUNET_RESOLVER_hostname_resolve (int af,
934 "gethostname"); 918 "gethostname");
935 return NULL; 919 return NULL;
936 } 920 }
937#if DEBUG_RESOLVER 921 LOG (GNUNET_ERROR_TYPE_DEBUG, "Resolving our hostname `%s'\n", hostname);
938 LOG (GNUNET_ERROR_TYPE_DEBUG, _("Resolving our hostname `%s'\n"), hostname);
939#endif
940 return GNUNET_RESOLVER_ip_get (hostname, af, timeout, callback, cls); 922 return GNUNET_RESOLVER_ip_get (hostname, af, timeout, callback, cls);
941} 923}
942 924