aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/namestore/gnunet-service-namestore.c10
-rw-r--r--src/namestore/test_namestore_api_store.c2
-rw-r--r--src/namestore/test_namestore_api_store_update.c29
3 files changed, 26 insertions, 15 deletions
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c
index 9c91e1975..e98fe30db 100644
--- a/src/namestore/gnunet-service-namestore.c
+++ b/src/namestore/gnunet-service-namestore.c
@@ -526,6 +526,7 @@ refresh_block (struct GNUNET_SERVER_Client *client,
526{ 526{
527 struct GNUNET_GNSRECORD_Block *block; 527 struct GNUNET_GNSRECORD_Block *block;
528 struct CacheOperation *cop; 528 struct CacheOperation *cop;
529 struct GNUNET_CRYPTO_EcdsaPublicKey pkey;
529 530
530 if (0 == rd_count) 531 if (0 == rd_count)
531 block = GNUNET_GNSRECORD_block_create (zone_key, 532 block = GNUNET_GNSRECORD_block_create (zone_key,
@@ -538,8 +539,12 @@ refresh_block (struct GNUNET_SERVER_Client *client,
538 rd), 539 rd),
539 name, 540 name,
540 rd, rd_count); 541 rd, rd_count);
542 GNUNET_CRYPTO_ecdsa_key_get_public (zone_key,
543 &pkey);
541 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 544 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
542 "Caching block in namecache\n"); 545 "Caching block for label `%s' in zone `%s' in namecache\n",
546 name,
547 GNUNET_GNSRECORD_z2s (&pkey));
543 cop = GNUNET_new (struct CacheOperation); 548 cop = GNUNET_new (struct CacheOperation);
544 cop->client = client; 549 cop->client = client;
545 cop->rid = rid; 550 cop->rid = rid;
@@ -675,7 +680,6 @@ handle_record_store (void *cls,
675 conv_name, 680 conv_name,
676 rd_count, rd); 681 rd_count, rd);
677 } 682 }
678 GNUNET_free (conv_name);
679 } 683 }
680 if (GNUNET_OK == res) 684 if (GNUNET_OK == res)
681 { 685 {
@@ -684,8 +688,10 @@ handle_record_store (void *cls,
684 conv_name, 688 conv_name,
685 rd_count, rd); 689 rd_count, rd);
686 GNUNET_SERVER_receive_done (client, GNUNET_OK); 690 GNUNET_SERVER_receive_done (client, GNUNET_OK);
691 GNUNET_free (conv_name);
687 return; 692 return;
688 } 693 }
694 GNUNET_free (conv_name);
689 } 695 }
690 send_store_response (client, res, rid); 696 send_store_response (client, res, rid);
691 GNUNET_SERVER_receive_done (client, GNUNET_OK); 697 GNUNET_SERVER_receive_done (client, GNUNET_OK);
diff --git a/src/namestore/test_namestore_api_store.c b/src/namestore/test_namestore_api_store.c
index d5583862c..424c826b7 100644
--- a/src/namestore/test_namestore_api_store.c
+++ b/src/namestore/test_namestore_api_store.c
@@ -102,6 +102,8 @@ put_cont (void *cls, int32_t success, const char *emsg)
102 "Name store added record for `%s': %s\n", 102 "Name store added record for `%s': %s\n",
103 name, 103 name,
104 (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); 104 (success == GNUNET_OK) ? "SUCCESS" : "FAIL");
105 GNUNET_SCHEDULER_cancel (endbadly_task);
106 endbadly_task = GNUNET_SCHEDULER_NO_TASK;
105 GNUNET_SCHEDULER_add_now (&end, NULL); 107 GNUNET_SCHEDULER_add_now (&end, NULL);
106} 108}
107 109
diff --git a/src/namestore/test_namestore_api_store_update.c b/src/namestore/test_namestore_api_store_update.c
index b2506f874..edc11067d 100644
--- a/src/namestore/test_namestore_api_store_update.c
+++ b/src/namestore/test_namestore_api_store_update.c
@@ -61,7 +61,7 @@ static struct GNUNET_NAMESTORE_QueueEntry *nsqe;
61 61
62static struct GNUNET_NAMECACHE_QueueEntry *ncqe; 62static struct GNUNET_NAMECACHE_QueueEntry *ncqe;
63 63
64static const char * name = "dummy.dummy.gnunet"; 64static const char *name = "dummy";
65 65
66 66
67static void 67static void
@@ -166,6 +166,8 @@ rd_decrypt_cb (void *cls,
166 GNUNET_assert (TEST_RECORD_DATALEN2 == rd[0].data_size); 166 GNUNET_assert (TEST_RECORD_DATALEN2 == rd[0].data_size);
167 GNUNET_assert (0 == memcmp (&rd_cmp_data, rd[0].data, TEST_RECORD_DATALEN2)); 167 GNUNET_assert (0 == memcmp (&rd_cmp_data, rd[0].data, TEST_RECORD_DATALEN2));
168 168
169 GNUNET_SCHEDULER_cancel (endbadly_task);
170 endbadly_task = GNUNET_SCHEDULER_NO_TASK;
169 GNUNET_SCHEDULER_add_now (&end, NULL); 171 GNUNET_SCHEDULER_add_now (&end, NULL);
170 } 172 }
171} 173}
@@ -179,16 +181,11 @@ name_lookup_proc (void *cls,
179 181
180 ncqe = NULL; 182 ncqe = NULL;
181 GNUNET_assert (NULL != cls); 183 GNUNET_assert (NULL != cls);
182 if (endbadly_task != GNUNET_SCHEDULER_NO_TASK)
183 {
184 GNUNET_SCHEDULER_cancel (endbadly_task);
185 endbadly_task = GNUNET_SCHEDULER_NO_TASK;
186 }
187
188 if (NULL == block) 184 if (NULL == block)
189 { 185 {
190 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 186 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
191 _("Namestore returned no block\n")); 187 _("Namecache returned no block for `%s'\n"),
188 name);
192 if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) 189 if (endbadly_task != GNUNET_SCHEDULER_NO_TASK)
193 GNUNET_SCHEDULER_cancel (endbadly_task); 190 GNUNET_SCHEDULER_cancel (endbadly_task);
194 endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); 191 endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL);
@@ -196,7 +193,7 @@ name_lookup_proc (void *cls,
196 } 193 }
197 194
198 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 195 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
199 "Namestore returned block, decrypting \n"); 196 "Namecache returned block, decrypting \n");
200 GNUNET_assert (GNUNET_OK == GNUNET_GNSRECORD_block_decrypt(block, 197 GNUNET_assert (GNUNET_OK == GNUNET_GNSRECORD_block_decrypt(block,
201 &pubkey, name, &rd_decrypt_cb, (void *) name)); 198 &pubkey, name, &rd_decrypt_cb, (void *) name));
202} 199}
@@ -215,7 +212,12 @@ put_cont (void *cls, int32_t success, const char *emsg)
215 name, 212 name,
216 (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); 213 (success == GNUNET_OK) ? "SUCCESS" : "FAIL");
217 /* Create derived hash */ 214 /* Create derived hash */
218 GNUNET_GNSRECORD_query_from_private_key (privkey, name, &derived_hash); 215 GNUNET_GNSRECORD_query_from_private_key (privkey,
216 name,
217 &derived_hash);
218 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
219 "Looking in namecache for `%s'\n",
220 GNUNET_h2s (&derived_hash));
219 ncqe = GNUNET_NAMECACHE_lookup_block (nch, &derived_hash, 221 ncqe = GNUNET_NAMECACHE_lookup_block (nch, &derived_hash,
220 &name_lookup_proc, (void *) name); 222 &name_lookup_proc, (void *) name);
221} 223}
@@ -253,14 +255,15 @@ run (void *cls,
253 GNUNET_break (NULL != nsh); 255 GNUNET_break (NULL != nsh);
254 nch = GNUNET_NAMECACHE_connect (cfg); 256 nch = GNUNET_NAMECACHE_connect (cfg);
255 GNUNET_break (NULL != nch); 257 GNUNET_break (NULL != nch);
256 nsqe = GNUNET_NAMESTORE_records_store (nsh, privkey, name, 258 nsqe = GNUNET_NAMESTORE_records_store (nsh,
257 1, &rd, &put_cont, (void *) name); 259 privkey, name,
260 1, &rd,
261 &put_cont, (void *) name);
258 if (NULL == nsqe) 262 if (NULL == nsqe)
259 { 263 {
260 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 264 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
261 _("Namestore cannot store no block\n")); 265 _("Namestore cannot store no block\n"));
262 } 266 }
263
264 GNUNET_free ((void *)rd.data); 267 GNUNET_free ((void *)rd.data);
265} 268}
266 269