aboutsummaryrefslogtreecommitdiff
path: root/src/gns/gnunet-service-gns_shorten.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gns/gnunet-service-gns_shorten.c')
-rw-r--r--src/gns/gnunet-service-gns_shorten.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/gns/gnunet-service-gns_shorten.c b/src/gns/gnunet-service-gns_shorten.c
index 3e612e862..2f0bf9644 100644
--- a/src/gns/gnunet-service-gns_shorten.c
+++ b/src/gns/gnunet-service-gns_shorten.c
@@ -94,6 +94,11 @@ struct GetPseuAuthorityHandle
94 struct GNUNET_NAMESTORE_QueueEntry *namestore_task; 94 struct GNUNET_NAMESTORE_QueueEntry *namestore_task;
95 95
96 /** 96 /**
97 * Handle to namecache request
98 */
99 struct GNUNET_NAMECACHE_QueueEntry *namecache_task;
100
101 /**
97 * Task to abort DHT lookup operation. 102 * Task to abort DHT lookup operation.
98 */ 103 */
99 GNUNET_SCHEDULER_TaskIdentifier timeout_task; 104 GNUNET_SCHEDULER_TaskIdentifier timeout_task;
@@ -117,6 +122,11 @@ static struct GetPseuAuthorityHandle *gph_tail;
117static struct GNUNET_NAMESTORE_Handle *namestore_handle; 122static struct GNUNET_NAMESTORE_Handle *namestore_handle;
118 123
119/** 124/**
125 * Our handle to the namecache service
126 */
127static struct GNUNET_NAMECACHE_Handle *namecache_handle;
128
129/**
120 * Resolver handle to the dht 130 * Resolver handle to the dht
121 */ 131 */
122static struct GNUNET_DHT_Handle *dht_handle; 132static struct GNUNET_DHT_Handle *dht_handle;
@@ -140,6 +150,11 @@ free_get_pseu_authority_handle (struct GetPseuAuthorityHandle *gph)
140 GNUNET_NAMESTORE_cancel (gph->namestore_task); 150 GNUNET_NAMESTORE_cancel (gph->namestore_task);
141 gph->namestore_task = NULL; 151 gph->namestore_task = NULL;
142 } 152 }
153 if (NULL != gph->namecache_task)
154 {
155 GNUNET_NAMECACHE_cancel (gph->namecache_task);
156 gph->namecache_task = NULL;
157 }
143 if (GNUNET_SCHEDULER_NO_TASK != gph->timeout_task) 158 if (GNUNET_SCHEDULER_NO_TASK != gph->timeout_task)
144 { 159 {
145 GNUNET_SCHEDULER_cancel (gph->timeout_task); 160 GNUNET_SCHEDULER_cancel (gph->timeout_task);
@@ -198,7 +213,7 @@ process_pseu_block_ns (void *cls,
198 struct GetPseuAuthorityHandle *gph = cls; 213 struct GetPseuAuthorityHandle *gph = cls;
199 struct GNUNET_CRYPTO_EcdsaPublicKey pub; 214 struct GNUNET_CRYPTO_EcdsaPublicKey pub;
200 215
201 gph->namestore_task = NULL; 216 gph->namecache_task = NULL;
202 if (NULL == block) 217 if (NULL == block)
203 { 218 {
204 process_pseu_lookup_ns (gph, 0, NULL); 219 process_pseu_lookup_ns (gph, 0, NULL);
@@ -240,7 +255,7 @@ perform_pseu_lookup (struct GetPseuAuthorityHandle *gph,
240 GNUNET_GNSRECORD_query_from_public_key (&pub, 255 GNUNET_GNSRECORD_query_from_public_key (&pub,
241 label, 256 label,
242 &query); 257 &query);
243 gph->namestore_task = GNUNET_NAMESTORE_lookup_block (namestore_handle, 258 gph->namecache_task = GNUNET_NAMECACHE_lookup_block (namecache_handle,
244 &query, 259 &query,
245 &process_pseu_block_ns, 260 &process_pseu_block_ns,
246 gph); 261 gph);
@@ -553,13 +568,16 @@ GNS_shorten_start (const char *original_label,
553 * Initialize the shortening subsystem 568 * Initialize the shortening subsystem
554 * 569 *
555 * @param nh the namestore handle 570 * @param nh the namestore handle
571 * @param nc the namecache handle
556 * @param dht the dht handle 572 * @param dht the dht handle
557 */ 573 */
558void 574void
559GNS_shorten_init (struct GNUNET_NAMESTORE_Handle *nh, 575GNS_shorten_init (struct GNUNET_NAMESTORE_Handle *nh,
576 struct GNUNET_NAMECACHE_Handle *nc,
560 struct GNUNET_DHT_Handle *dht) 577 struct GNUNET_DHT_Handle *dht)
561{ 578{
562 namestore_handle = nh; 579 namestore_handle = nh;
580 namecache_handle = nc;
563 dht_handle = dht; 581 dht_handle = dht;
564} 582}
565 583
@@ -575,6 +593,7 @@ GNS_shorten_done ()
575 free_get_pseu_authority_handle (gph_head); 593 free_get_pseu_authority_handle (gph_head);
576 dht_handle = NULL; 594 dht_handle = NULL;
577 namestore_handle = NULL; 595 namestore_handle = NULL;
596 namecache_handle = NULL;
578} 597}
579 598
580/* end of gnunet-service-gns_shorten.c */ 599/* end of gnunet-service-gns_shorten.c */