aboutsummaryrefslogtreecommitdiff
path: root/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2012-03-07 08:49:30 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2012-03-07 08:49:30 +0000
commita76f6c6081fa2f663d0f35cb10f657291a86af57 (patch)
tree79cd928035f06e96e64d1742be9bed002dac940b /src/namestore/test_namestore_api_zone_iteration_specific_zone.c
parent6b5bfde9f5cb4432c6d09465d784a39c75365a75 (diff)
downloadgnunet-a76f6c6081fa2f663d0f35cb10f657291a86af57.tar.gz
gnunet-a76f6c6081fa2f663d0f35cb10f657291a86af57.zip
- complete test
Diffstat (limited to 'src/namestore/test_namestore_api_zone_iteration_specific_zone.c')
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_specific_zone.c38
1 files changed, 22 insertions, 16 deletions
diff --git a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
index 007010228..019036991 100644
--- a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
+++ b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
@@ -100,6 +100,7 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
100 GNUNET_free_non_null(sig_2); 100 GNUNET_free_non_null(sig_2);
101 GNUNET_free_non_null(s_name_1); 101 GNUNET_free_non_null(s_name_1);
102 GNUNET_free_non_null(s_name_2); 102 GNUNET_free_non_null(s_name_2);
103
103 if (s_rd_1 != NULL) 104 if (s_rd_1 != NULL)
104 { 105 {
105 GNUNET_free ((void *)s_rd_1->data); 106 GNUNET_free ((void *)s_rd_1->data);
@@ -137,15 +138,14 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
137 endbadly_task = GNUNET_SCHEDULER_NO_TASK; 138 endbadly_task = GNUNET_SCHEDULER_NO_TASK;
138 } 139 }
139 140
140
141 if (privkey != NULL) 141 if (privkey != NULL)
142 GNUNET_CRYPTO_rsa_key_free (privkey); 142 GNUNET_CRYPTO_rsa_key_free (privkey);
143 privkey = NULL; 143 privkey = NULL;
144 144
145 GNUNET_free_non_null(sig_1); 145 GNUNET_free (sig_1);
146 GNUNET_free_non_null(sig_2); 146 GNUNET_free (sig_2);
147 GNUNET_free_non_null(s_name_1); 147 GNUNET_free (s_name_1);
148 GNUNET_free_non_null(s_name_2); 148 GNUNET_free (s_name_2);
149 if (s_rd_1 != NULL) 149 if (s_rd_1 != NULL)
150 { 150 {
151 GNUNET_free ((void *)s_rd_1->data); 151 GNUNET_free ((void *)s_rd_1->data);
@@ -164,8 +164,6 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
164 164
165 if (NULL != arm) 165 if (NULL != arm)
166 stop_arm(); 166 stop_arm();
167
168 res = 0;
169} 167}
170 168
171void zone_proc (void *cls, 169void zone_proc (void *cls,
@@ -227,7 +225,6 @@ void zone_proc (void *cls,
227 failed = GNUNET_YES; 225 failed = GNUNET_YES;
228 GNUNET_break (0); 226 GNUNET_break (0);
229 } 227 }
230
231 } 228 }
232 else 229 else
233 { 230 {
@@ -238,6 +235,7 @@ void zone_proc (void *cls,
238 235
239 if (failed == GNUNET_NO) 236 if (failed == GNUNET_NO)
240 { 237 {
238 res --;
241 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Telling namestore to send the next result\n"); 239 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Telling namestore to send the next result\n");
242 GNUNET_NAMESTORE_zone_iterator_next (zi); 240 GNUNET_NAMESTORE_zone_iterator_next (zi);
243 } 241 }
@@ -276,11 +274,20 @@ put_cont (void *cls, int32_t success, const char *emsg)
276 { 274 {
277 c++; 275 c++;
278 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created record %u \n", c); 276 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created record %u \n", c);
279 277 }
278 else
279 {
280 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to created records\n");
281 GNUNET_break (0);
282 GNUNET_SCHEDULER_cancel (endbadly_task);
283 endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL);
280 } 284 }
281 285
282 if (c == 2) 286 if (c == 2)
283 { 287 {
288 res = 2;
289 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All records created, starting iteration over zone `%s'\n",
290 GNUNET_h2s(&zone));
284 zi = GNUNET_NAMESTORE_zone_iteration_start(nsh, 291 zi = GNUNET_NAMESTORE_zone_iteration_start(nsh,
285 &zone, 292 &zone,
286 GNUNET_NAMESTORE_RF_NONE, 293 GNUNET_NAMESTORE_RF_NONE,
@@ -289,6 +296,7 @@ put_cont (void *cls, int32_t success, const char *emsg)
289 &zone); 296 &zone);
290 if (zi == NULL) 297 if (zi == NULL)
291 { 298 {
299 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to create zone iterator\n");
292 GNUNET_break (0); 300 GNUNET_break (0);
293 GNUNET_SCHEDULER_cancel (endbadly_task); 301 GNUNET_SCHEDULER_cancel (endbadly_task);
294 endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); 302 endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL);
@@ -305,11 +313,11 @@ create_record (int count)
305 313
306 for (c = 0; c < count; c++) 314 for (c = 0; c < count; c++)
307 { 315 {
308 rd[c].expiration = GNUNET_TIME_absolute_get(); 316 rd[c].expiration = GNUNET_TIME_absolute_get();
309 rd[c].record_type = 1111; 317 rd[c].record_type = 1111;
310 rd[c].data_size = 50; 318 rd[c].data_size = 50;
311 rd[c].data = GNUNET_malloc(50); 319 rd[c].data = GNUNET_malloc(50);
312 memset ((char *) rd[c].data, 'a', 50); 320 memset ((char *) rd[c].data, 'a', 50);
313 } 321 }
314 return rd; 322 return rd;
315} 323}
@@ -334,8 +342,6 @@ run (void *cls, char *const *args, const char *cfgfile,
334 342
335 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created record 1\n"); 343 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created record 1\n");
336 344
337
338
339 GNUNET_asprintf(&s_name_1, "dummy1"); 345 GNUNET_asprintf(&s_name_1, "dummy1");
340 s_rd_1 = create_record(1); 346 s_rd_1 = create_record(1);
341 sig_1 = GNUNET_NAMESTORE_create_signature(privkey, s_name_1, s_rd_1, 1); 347 sig_1 = GNUNET_NAMESTORE_create_signature(privkey, s_name_1, s_rd_1, 1);