aboutsummaryrefslogtreecommitdiff
path: root/src/gns/gnunet-service-gns.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gns/gnunet-service-gns.c')
-rw-r--r--src/gns/gnunet-service-gns.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c
index ff574c3a1..53d6c11a4 100644
--- a/src/gns/gnunet-service-gns.c
+++ b/src/gns/gnunet-service-gns.c
@@ -28,6 +28,7 @@
28#include "gnunet_dns_service.h" 28#include "gnunet_dns_service.h"
29#include "gnunet_dnsparser_lib.h" 29#include "gnunet_dnsparser_lib.h"
30#include "gnunet_dht_service.h" 30#include "gnunet_dht_service.h"
31#include "gnunet_namecache_service.h"
31#include "gnunet_namestore_service.h" 32#include "gnunet_namestore_service.h"
32#include "gnunet_gns_service.h" 33#include "gnunet_gns_service.h"
33#include "gnunet_statistics_service.h" 34#include "gnunet_statistics_service.h"
@@ -121,6 +122,11 @@ static struct GNUNET_DHT_PutHandle *active_put;
121static struct GNUNET_NAMESTORE_Handle *namestore_handle; 122static struct GNUNET_NAMESTORE_Handle *namestore_handle;
122 123
123/** 124/**
125 * Our handle to the namecache service
126 */
127static struct GNUNET_NAMECACHE_Handle *namecache_handle;
128
129/**
124 * Handle to iterate over our authoritative zone in namestore 130 * Handle to iterate over our authoritative zone in namestore
125 */ 131 */
126static struct GNUNET_NAMESTORE_ZoneIterator *namestore_iter; 132static struct GNUNET_NAMESTORE_ZoneIterator *namestore_iter;
@@ -231,6 +237,11 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
231 GNUNET_NAMESTORE_disconnect (namestore_handle); 237 GNUNET_NAMESTORE_disconnect (namestore_handle);
232 namestore_handle = NULL; 238 namestore_handle = NULL;
233 } 239 }
240 if (NULL != namecache_handle)
241 {
242 GNUNET_NAMECACHE_disconnect (namecache_handle);
243 namecache_handle = NULL;
244 }
234 if (NULL != active_put) 245 if (NULL != active_put)
235 { 246 {
236 GNUNET_DHT_put_cancel (active_put); 247 GNUNET_DHT_put_cancel (active_put);
@@ -645,6 +656,14 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
645 GNUNET_SCHEDULER_shutdown (); 656 GNUNET_SCHEDULER_shutdown ();
646 return; 657 return;
647 } 658 }
659 namecache_handle = GNUNET_NAMECACHE_connect (c);
660 if (NULL == namecache_handle)
661 {
662 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
663 _("Failed to connect to the namecache!\n"));
664 GNUNET_SCHEDULER_shutdown ();
665 return;
666 }
648 667
649 put_interval = INITIAL_PUT_INTERVAL; 668 put_interval = INITIAL_PUT_INTERVAL;
650 zone_publish_time_window = DEFAULT_ZONE_PUBLISH_TIME_WINDOW; 669 zone_publish_time_window = DEFAULT_ZONE_PUBLISH_TIME_WINDOW;
@@ -705,10 +724,14 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
705 return; 724 return;
706 } 725 }
707 } 726 }
708 GNS_resolver_init (namestore_handle, dht_handle, 727 GNS_resolver_init (namestore_handle,
728 namecache_handle,
729 dht_handle,
709 c, 730 c,
710 max_parallel_bg_queries); 731 max_parallel_bg_queries);
711 GNS_shorten_init (namestore_handle, dht_handle); 732 GNS_shorten_init (namestore_handle,
733 namecache_handle,
734 dht_handle);
712 GNUNET_SERVER_disconnect_notify (server, 735 GNUNET_SERVER_disconnect_notify (server,
713 &notify_client_disconnect, 736 &notify_client_disconnect,
714 NULL); 737 NULL);