aboutsummaryrefslogtreecommitdiff
path: root/src/gns/gnunet-service-gns.c
diff options
context:
space:
mode:
authorMartin Schanzenbach <mschanzenbach@posteo.de>2012-03-22 16:36:39 +0000
committerMartin Schanzenbach <mschanzenbach@posteo.de>2012-03-22 16:36:39 +0000
commitdd333f69e55bd7e2b94b4bb281e9b0c0b63c23f2 (patch)
treebdaa5f02741deb8695a347dcfc814657907d301d /src/gns/gnunet-service-gns.c
parent51191c78817e2634f52584b6830e4d792c239670 (diff)
downloadgnunet-dd333f69e55bd7e2b94b4bb281e9b0c0b63c23f2.tar.gz
gnunet-dd333f69e55bd7e2b94b4bb281e9b0c0b63c23f2.zip
-parallel background lookups
Diffstat (limited to 'src/gns/gnunet-service-gns.c')
-rw-r--r--src/gns/gnunet-service-gns.c39
1 files changed, 32 insertions, 7 deletions
diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c
index 37d53bfd3..dff300bb7 100644
--- a/src/gns/gnunet-service-gns.c
+++ b/src/gns/gnunet-service-gns.c
@@ -20,10 +20,6 @@
20 20
21/** 21/**
22 * 22 *
23 * TODO:
24 * - Write xquery and block plugin
25 * - The smaller FIXME issues all around
26 *
27 * @file gns/gnunet-service-gns.c 23 * @file gns/gnunet-service-gns.c
28 * @brief GNUnet GNS service 24 * @brief GNUnet GNS service
29 * @author Martin Schanzenbach 25 * @author Martin Schanzenbach
@@ -155,6 +151,9 @@ GNUNET_SCHEDULER_TaskIdentifier zone_update_taskid = GNUNET_SCHEDULER_NO_TASK;
155/* automatic pkey import for name shortening */ 151/* automatic pkey import for name shortening */
156static int auto_import_pkey; 152static int auto_import_pkey;
157 153
154/* lookup timeout */
155static struct GNUNET_TIME_Relative default_lookup_timeout;
156
158/** 157/**
159 * Task run during shutdown. 158 * Task run during shutdown.
160 * 159 *
@@ -174,6 +173,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
174 GNUNET_SERVER_notification_context_destroy (nc); 173 GNUNET_SERVER_notification_context_destroy (nc);
175 174
176 gns_interceptor_stop(); 175 gns_interceptor_stop();
176 gns_resolver_cleanup();
177 177
178 GNUNET_NAMESTORE_disconnect(namestore_handle, 1); 178 GNUNET_NAMESTORE_disconnect(namestore_handle, 1);
179 GNUNET_DHT_disconnect(dht_handle); 179 GNUNET_DHT_disconnect(dht_handle);
@@ -723,14 +723,14 @@ handle_lookup(void *cls,
723 { 723 {
724 gns_resolver_lookup_record(zone_hash, clh->type, name, 724 gns_resolver_lookup_record(zone_hash, clh->type, name,
725 zone_key, 725 zone_key,
726 GNUNET_GNS_DEFAULT_LOOKUP_TIMEOUT, 726 default_lookup_timeout,
727 &send_lookup_response, clh); 727 &send_lookup_response, clh);
728 } 728 }
729 else 729 else
730 { 730 {
731 gns_resolver_lookup_record(zone_hash, clh->type, name, 731 gns_resolver_lookup_record(zone_hash, clh->type, name,
732 NULL, 732 NULL,
733 GNUNET_GNS_DEFAULT_LOOKUP_TIMEOUT, 733 default_lookup_timeout,
734 &send_lookup_response, clh); 734 &send_lookup_response, clh);
735 } 735 }
736} 736}
@@ -753,6 +753,8 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
753 753
754 char* keyfile; 754 char* keyfile;
755 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey; 755 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey;
756 unsigned long long max_parallel_bg_queries = 0;
757 unsigned long long default_lookup_timeout_secs = 0;
756 758
757 static const struct GNUNET_SERVER_MessageHandler handlers[] = { 759 static const struct GNUNET_SERVER_MessageHandler handlers[] = {
758 {&handle_shorten, NULL, GNUNET_MESSAGE_TYPE_GNS_SHORTEN, 0}, 760 {&handle_shorten, NULL, GNUNET_MESSAGE_TYPE_GNS_SHORTEN, 0},
@@ -813,8 +815,31 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
813 auto_import_pkey = GNUNET_YES; 815 auto_import_pkey = GNUNET_YES;
814 816
815 } 817 }
818
819 if (GNUNET_OK ==
820 GNUNET_CONFIGURATION_get_value_number(c, "gns",
821 "MAX_PARALLEL_BACKGROUND_QUERIES",
822 &max_parallel_bg_queries))
823 {
824 GNUNET_log(GNUNET_ERROR_TYPE_INFO,
825 "Number of allowed parallel background queries: %d\n",
826 max_parallel_bg_queries);
827 }
828
829 if (GNUNET_OK ==
830 GNUNET_CONFIGURATION_get_value_number(c, "gns",
831 "DEFAULT_LOOKUP_TIMEOUT",
832 &default_lookup_timeout_secs))
833 {
834 GNUNET_log(GNUNET_ERROR_TYPE_INFO,
835 "Default lookup timeout: %ds\n", default_lookup_timeout_secs);
836 default_lookup_timeout = GNUNET_TIME_relative_multiply(
837 GNUNET_TIME_UNIT_SECONDS,
838 default_lookup_timeout_secs);
839 }
816 840
817 if (gns_resolver_init(namestore_handle, dht_handle) 841 if (gns_resolver_init(namestore_handle, dht_handle, zone_hash,
842 max_parallel_bg_queries)
818 == GNUNET_SYSERR) 843 == GNUNET_SYSERR)
819 { 844 {
820 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, 845 GNUNET_log(GNUNET_ERROR_TYPE_ERROR,