diff options
Diffstat (limited to 'src/reclaim/gnunet-service-reclaim_tickets.c')
-rw-r--r-- | src/reclaim/gnunet-service-reclaim_tickets.c | 439 |
1 files changed, 405 insertions, 34 deletions
diff --git a/src/reclaim/gnunet-service-reclaim_tickets.c b/src/reclaim/gnunet-service-reclaim_tickets.c index 033684f71..a39a4be5a 100644 --- a/src/reclaim/gnunet-service-reclaim_tickets.c +++ b/src/reclaim/gnunet-service-reclaim_tickets.c | |||
@@ -26,6 +26,94 @@ | |||
26 | */ | 26 | */ |
27 | #include "gnunet-service-reclaim_tickets.h" | 27 | #include "gnunet-service-reclaim_tickets.h" |
28 | 28 | ||
29 | struct ParallelLookup; | ||
30 | |||
31 | struct RECLAIM_TICKETS_ConsumeHandle | ||
32 | { | ||
33 | /** | ||
34 | * Ticket | ||
35 | */ | ||
36 | struct GNUNET_RECLAIM_Ticket ticket; | ||
37 | |||
38 | /** | ||
39 | * LookupRequest | ||
40 | */ | ||
41 | struct GNUNET_GNS_LookupRequest *lookup_request; | ||
42 | |||
43 | /** | ||
44 | * Audience Key | ||
45 | */ | ||
46 | struct GNUNET_CRYPTO_EcdsaPrivateKey identity; | ||
47 | |||
48 | /** | ||
49 | * Audience Key | ||
50 | */ | ||
51 | struct GNUNET_CRYPTO_EcdsaPublicKey identity_pub; | ||
52 | |||
53 | /** | ||
54 | * Lookup DLL | ||
55 | */ | ||
56 | struct ParallelLookup *parallel_lookups_head; | ||
57 | |||
58 | /** | ||
59 | * Lookup DLL | ||
60 | */ | ||
61 | struct ParallelLookup *parallel_lookups_tail; | ||
62 | |||
63 | /** | ||
64 | * Kill task | ||
65 | */ | ||
66 | struct GNUNET_SCHEDULER_Task *kill_task; | ||
67 | |||
68 | /** | ||
69 | * Attributes | ||
70 | */ | ||
71 | struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs; | ||
72 | |||
73 | /** | ||
74 | * Lookup time | ||
75 | */ | ||
76 | struct GNUNET_TIME_Absolute lookup_start_time; | ||
77 | |||
78 | /** | ||
79 | * Callback | ||
80 | */ | ||
81 | RECLAIM_TICKETS_ConsumeCallback cb; | ||
82 | |||
83 | /** | ||
84 | * Callbacl closure | ||
85 | */ | ||
86 | void *cb_cls; | ||
87 | |||
88 | }; | ||
89 | |||
90 | /** | ||
91 | * Handle for a parallel GNS lookup job | ||
92 | */ | ||
93 | struct ParallelLookup | ||
94 | { | ||
95 | /* DLL */ | ||
96 | struct ParallelLookup *next; | ||
97 | |||
98 | /* DLL */ | ||
99 | struct ParallelLookup *prev; | ||
100 | |||
101 | /* The GNS request */ | ||
102 | struct GNUNET_GNS_LookupRequest *lookup_request; | ||
103 | |||
104 | /* The handle the return to */ | ||
105 | struct RECLAIM_TICKETS_ConsumeHandle *handle; | ||
106 | |||
107 | /** | ||
108 | * Lookup time | ||
109 | */ | ||
110 | struct GNUNET_TIME_Absolute lookup_start_time; | ||
111 | |||
112 | /* The label to look up */ | ||
113 | char *label; | ||
114 | }; | ||
115 | |||
116 | |||
29 | /** | 117 | /** |
30 | * A reference to a ticket stored in GNS | 118 | * A reference to a ticket stored in GNS |
31 | */ | 119 | */ |
@@ -146,8 +234,295 @@ struct RECLAIM_TICKETS_Iterator | |||
146 | struct TicketReference *tickets_tail; | 234 | struct TicketReference *tickets_tail; |
147 | }; | 235 | }; |
148 | 236 | ||
237 | /* Namestore handle */ | ||
149 | static struct GNUNET_NAMESTORE_Handle *nsh; | 238 | static struct GNUNET_NAMESTORE_Handle *nsh; |
150 | 239 | ||
240 | /* GNS handle */ | ||
241 | static struct GNUNET_GNS_Handle *gns; | ||
242 | |||
243 | /* Handle to the statistics service */ | ||
244 | static struct GNUNET_STATISTICS_Handle *stats; | ||
245 | |||
246 | static int | ||
247 | create_sym_key_from_ecdh (const struct GNUNET_HashCode *new_key_hash, | ||
248 | struct GNUNET_CRYPTO_SymmetricSessionKey *skey, | ||
249 | struct GNUNET_CRYPTO_SymmetricInitializationVector *iv) | ||
250 | { | ||
251 | struct GNUNET_CRYPTO_HashAsciiEncoded new_key_hash_str; | ||
252 | |||
253 | GNUNET_CRYPTO_hash_to_enc (new_key_hash, | ||
254 | &new_key_hash_str); | ||
255 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating symmetric rsa key from %s\n", (char*)&new_key_hash_str); | ||
256 | static const char ctx_key[] = "gnuid-aes-ctx-key"; | ||
257 | GNUNET_CRYPTO_kdf (skey, sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey), | ||
258 | new_key_hash, sizeof (struct GNUNET_HashCode), | ||
259 | ctx_key, strlen (ctx_key), | ||
260 | NULL, 0); | ||
261 | static const char ctx_iv[] = "gnuid-aes-ctx-iv"; | ||
262 | GNUNET_CRYPTO_kdf (iv, sizeof (struct GNUNET_CRYPTO_SymmetricInitializationVector), | ||
263 | new_key_hash, sizeof (struct GNUNET_HashCode), | ||
264 | ctx_iv, strlen (ctx_iv), | ||
265 | NULL, 0); | ||
266 | return GNUNET_OK; | ||
267 | } | ||
268 | |||
269 | |||
270 | /** | ||
271 | * Cleanup ticket consume handle | ||
272 | * @param cth the handle to clean up | ||
273 | */ | ||
274 | static void | ||
275 | cleanup_cth (struct RECLAIM_TICKETS_ConsumeHandle *cth) | ||
276 | { | ||
277 | struct ParallelLookup *lu; | ||
278 | struct ParallelLookup *tmp; | ||
279 | if (NULL != cth->lookup_request) | ||
280 | GNUNET_GNS_lookup_cancel (cth->lookup_request); | ||
281 | for (lu = cth->parallel_lookups_head; | ||
282 | NULL != lu;) { | ||
283 | GNUNET_GNS_lookup_cancel (lu->lookup_request); | ||
284 | GNUNET_free (lu->label); | ||
285 | tmp = lu->next; | ||
286 | GNUNET_CONTAINER_DLL_remove (cth->parallel_lookups_head, | ||
287 | cth->parallel_lookups_tail, | ||
288 | lu); | ||
289 | GNUNET_free (lu); | ||
290 | lu = tmp; | ||
291 | } | ||
292 | |||
293 | if (NULL != cth->attrs) | ||
294 | GNUNET_RECLAIM_ATTRIBUTE_list_destroy (cth->attrs); | ||
295 | GNUNET_free (cth); | ||
296 | } | ||
297 | |||
298 | |||
299 | static void | ||
300 | process_parallel_lookup_result (void *cls, | ||
301 | uint32_t rd_count, | ||
302 | const struct GNUNET_GNSRECORD_Data *rd) | ||
303 | { | ||
304 | struct ParallelLookup *parallel_lookup = cls; | ||
305 | struct RECLAIM_TICKETS_ConsumeHandle *cth = parallel_lookup->handle; | ||
306 | struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *attr_le; | ||
307 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
308 | "Parallel lookup finished (count=%u)\n", rd_count); | ||
309 | |||
310 | GNUNET_CONTAINER_DLL_remove (cth->parallel_lookups_head, | ||
311 | cth->parallel_lookups_tail, | ||
312 | parallel_lookup); | ||
313 | GNUNET_free (parallel_lookup->label); | ||
314 | |||
315 | GNUNET_STATISTICS_update (stats, | ||
316 | "attribute_lookup_time_total", | ||
317 | GNUNET_TIME_absolute_get_duration (parallel_lookup->lookup_start_time).rel_value_us, | ||
318 | GNUNET_YES); | ||
319 | GNUNET_STATISTICS_update (stats, | ||
320 | "attribute_lookups_count", | ||
321 | 1, | ||
322 | GNUNET_YES); | ||
323 | |||
324 | |||
325 | GNUNET_free (parallel_lookup); | ||
326 | if (1 != rd_count) | ||
327 | GNUNET_break(0);//TODO | ||
328 | if (rd->record_type == GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR) | ||
329 | { | ||
330 | attr_le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry); | ||
331 | attr_le->claim = GNUNET_RECLAIM_ATTRIBUTE_deserialize (rd->data, | ||
332 | rd->data_size); | ||
333 | GNUNET_CONTAINER_DLL_insert (cth->attrs->list_head, | ||
334 | cth->attrs->list_tail, | ||
335 | attr_le); | ||
336 | } | ||
337 | if (NULL != cth->parallel_lookups_head) | ||
338 | return; //Wait for more | ||
339 | /* Else we are done */ | ||
340 | |||
341 | GNUNET_SCHEDULER_cancel (cth->kill_task); | ||
342 | cth->cb (cth->cb_cls, | ||
343 | &cth->ticket.identity, | ||
344 | cth->attrs, | ||
345 | GNUNET_OK, | ||
346 | NULL); | ||
347 | cleanup_cth (cth); | ||
348 | } | ||
349 | |||
350 | |||
351 | static void | ||
352 | abort_parallel_lookups (void *cls) | ||
353 | { | ||
354 | struct RECLAIM_TICKETS_ConsumeHandle *cth = cls; | ||
355 | struct ParallelLookup *lu; | ||
356 | struct ParallelLookup *tmp; | ||
357 | |||
358 | cth->kill_task = NULL; | ||
359 | for (lu = cth->parallel_lookups_head; | ||
360 | NULL != lu;) { | ||
361 | GNUNET_GNS_lookup_cancel (lu->lookup_request); | ||
362 | GNUNET_free (lu->label); | ||
363 | tmp = lu->next; | ||
364 | GNUNET_CONTAINER_DLL_remove (cth->parallel_lookups_head, | ||
365 | cth->parallel_lookups_tail, | ||
366 | lu); | ||
367 | GNUNET_free (lu); | ||
368 | lu = tmp; | ||
369 | } | ||
370 | cth->cb (cth->cb_cls, | ||
371 | NULL, | ||
372 | NULL, | ||
373 | GNUNET_SYSERR, | ||
374 | "Aborted"); | ||
375 | |||
376 | } | ||
377 | |||
378 | |||
379 | |||
380 | static void | ||
381 | lookup_authz_cb (void *cls, | ||
382 | uint32_t rd_count, | ||
383 | const struct GNUNET_GNSRECORD_Data *rd) | ||
384 | { | ||
385 | struct RECLAIM_TICKETS_ConsumeHandle *cth = cls; | ||
386 | struct GNUNET_HashCode new_key_hash; | ||
387 | struct GNUNET_CRYPTO_SymmetricSessionKey enc_key; | ||
388 | struct GNUNET_CRYPTO_SymmetricInitializationVector enc_iv; | ||
389 | struct GNUNET_CRYPTO_EcdhePublicKey *ecdh_key; | ||
390 | struct ParallelLookup *parallel_lookup; | ||
391 | size_t size; | ||
392 | char *buf; | ||
393 | char *attr_lbl; | ||
394 | char *lbls; | ||
395 | |||
396 | cth->lookup_request = NULL; | ||
397 | if (1 != rd_count) | ||
398 | { | ||
399 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
400 | "Number of keys %d != 1.", | ||
401 | rd_count); | ||
402 | cth->cb (cth->cb_cls, | ||
403 | NULL, | ||
404 | NULL, | ||
405 | GNUNET_SYSERR, | ||
406 | "Number of keys %d != 1."); | ||
407 | cleanup_cth (cth); | ||
408 | return; | ||
409 | } | ||
410 | |||
411 | //Decrypt | ||
412 | ecdh_key = (struct GNUNET_CRYPTO_EcdhePublicKey *)rd->data; | ||
413 | |||
414 | buf = GNUNET_malloc (rd->data_size | ||
415 | - sizeof (struct GNUNET_CRYPTO_EcdhePublicKey)); | ||
416 | |||
417 | //Calculate symmetric key from ecdh parameters | ||
418 | GNUNET_assert (GNUNET_OK == | ||
419 | GNUNET_CRYPTO_ecdsa_ecdh (&cth->identity, | ||
420 | ecdh_key, | ||
421 | &new_key_hash)); | ||
422 | create_sym_key_from_ecdh (&new_key_hash, | ||
423 | &enc_key, | ||
424 | &enc_iv); | ||
425 | size = GNUNET_CRYPTO_symmetric_decrypt (rd->data | ||
426 | + sizeof (struct GNUNET_CRYPTO_EcdhePublicKey), | ||
427 | rd->data_size | ||
428 | - sizeof (struct GNUNET_CRYPTO_EcdhePublicKey), | ||
429 | &enc_key, | ||
430 | &enc_iv, | ||
431 | buf); | ||
432 | |||
433 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
434 | "Decrypted bytes: %zd Expected bytes: %zd\n", | ||
435 | size, | ||
436 | rd->data_size - sizeof (struct GNUNET_CRYPTO_EcdhePublicKey)); | ||
437 | GNUNET_STATISTICS_update (stats, | ||
438 | "reclaim_authz_lookup_time_total", | ||
439 | GNUNET_TIME_absolute_get_duration (cth->lookup_start_time).rel_value_us, | ||
440 | GNUNET_YES); | ||
441 | GNUNET_STATISTICS_update (stats, | ||
442 | "reclaim_authz_lookups_count", | ||
443 | 1, | ||
444 | GNUNET_YES); | ||
445 | lbls = GNUNET_strdup (buf); | ||
446 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
447 | "Attributes found %s\n", lbls); | ||
448 | |||
449 | for (attr_lbl = strtok (lbls, ","); | ||
450 | NULL != attr_lbl; | ||
451 | attr_lbl = strtok (NULL, ",")) | ||
452 | { | ||
453 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
454 | "Looking up %s\n", attr_lbl); | ||
455 | parallel_lookup = GNUNET_new (struct ParallelLookup); | ||
456 | parallel_lookup->handle = cth; | ||
457 | parallel_lookup->label = GNUNET_strdup (attr_lbl); | ||
458 | parallel_lookup->lookup_start_time = GNUNET_TIME_absolute_get(); | ||
459 | parallel_lookup->lookup_request | ||
460 | = GNUNET_GNS_lookup (gns, | ||
461 | attr_lbl, | ||
462 | &cth->ticket.identity, | ||
463 | GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR, | ||
464 | GNUNET_GNS_LO_DEFAULT, | ||
465 | &process_parallel_lookup_result, | ||
466 | parallel_lookup); | ||
467 | GNUNET_CONTAINER_DLL_insert (cth->parallel_lookups_head, | ||
468 | cth->parallel_lookups_tail, | ||
469 | parallel_lookup); | ||
470 | } | ||
471 | GNUNET_free (lbls); | ||
472 | GNUNET_free (buf); | ||
473 | cth->kill_task = GNUNET_SCHEDULER_add_delayed ( | ||
474 | GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES,3), | ||
475 | &abort_parallel_lookups, | ||
476 | cth); | ||
477 | } | ||
478 | |||
479 | |||
480 | |||
481 | struct RECLAIM_TICKETS_ConsumeHandle* | ||
482 | RECLAIM_TICKETS_consume (const struct GNUNET_CRYPTO_EcdsaPrivateKey *id, | ||
483 | const struct GNUNET_RECLAIM_Ticket *ticket, | ||
484 | RECLAIM_TICKETS_ConsumeCallback cb, | ||
485 | void* cb_cls) | ||
486 | { | ||
487 | struct RECLAIM_TICKETS_ConsumeHandle *cth; | ||
488 | char *label; | ||
489 | cth = GNUNET_new (struct RECLAIM_TICKETS_ConsumeHandle); | ||
490 | |||
491 | cth->identity = *id; | ||
492 | GNUNET_CRYPTO_ecdsa_key_get_public (&cth->identity, | ||
493 | &cth->identity_pub); | ||
494 | cth->attrs = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList); | ||
495 | cth->ticket = *ticket; | ||
496 | cth->cb = cb; | ||
497 | cth->cb_cls = cb_cls; | ||
498 | label = GNUNET_STRINGS_data_to_string_alloc (&cth->ticket.rnd, | ||
499 | sizeof (uint64_t)); | ||
500 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
501 | "Looking for AuthZ info under %s\n", label); | ||
502 | cth->lookup_start_time = GNUNET_TIME_absolute_get (); | ||
503 | cth->lookup_request = GNUNET_GNS_lookup (gns, | ||
504 | label, | ||
505 | &cth->ticket.identity, | ||
506 | GNUNET_GNSRECORD_TYPE_RECLAIM_AUTHZ, | ||
507 | GNUNET_GNS_LO_DEFAULT, | ||
508 | &lookup_authz_cb, | ||
509 | cth); | ||
510 | GNUNET_free (label); | ||
511 | return cth; | ||
512 | } | ||
513 | |||
514 | void | ||
515 | RECLAIM_TICKETS_consume_cancel (struct RECLAIM_TICKETS_ConsumeHandle *cth) | ||
516 | { | ||
517 | cleanup_cth (cth); | ||
518 | return; | ||
519 | } | ||
520 | |||
521 | |||
522 | /******************************* | ||
523 | * Ticket issue | ||
524 | *******************************/ | ||
525 | |||
151 | /** | 526 | /** |
152 | * Cleanup ticket consume handle | 527 | * Cleanup ticket consume handle |
153 | * @param handle the handle to clean up | 528 | * @param handle the handle to clean up |
@@ -325,29 +700,6 @@ store_ticket_issue_cont (void *cls, | |||
325 | handle); | 700 | handle); |
326 | } | 701 | } |
327 | 702 | ||
328 | static int | ||
329 | create_sym_key_from_ecdh (const struct GNUNET_HashCode *new_key_hash, | ||
330 | struct GNUNET_CRYPTO_SymmetricSessionKey *skey, | ||
331 | struct GNUNET_CRYPTO_SymmetricInitializationVector *iv) | ||
332 | { | ||
333 | struct GNUNET_CRYPTO_HashAsciiEncoded new_key_hash_str; | ||
334 | |||
335 | GNUNET_CRYPTO_hash_to_enc (new_key_hash, | ||
336 | &new_key_hash_str); | ||
337 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating symmetric rsa key from %s\n", (char*)&new_key_hash_str); | ||
338 | static const char ctx_key[] = "gnuid-aes-ctx-key"; | ||
339 | GNUNET_CRYPTO_kdf (skey, sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey), | ||
340 | new_key_hash, sizeof (struct GNUNET_HashCode), | ||
341 | ctx_key, strlen (ctx_key), | ||
342 | NULL, 0); | ||
343 | static const char ctx_iv[] = "gnuid-aes-ctx-iv"; | ||
344 | GNUNET_CRYPTO_kdf (iv, sizeof (struct GNUNET_CRYPTO_SymmetricInitializationVector), | ||
345 | new_key_hash, sizeof (struct GNUNET_HashCode), | ||
346 | ctx_iv, strlen (ctx_iv), | ||
347 | NULL, 0); | ||
348 | return GNUNET_OK; | ||
349 | } | ||
350 | |||
351 | 703 | ||
352 | static int | 704 | static int |
353 | serialize_authz_record (const struct GNUNET_RECLAIM_Ticket *ticket, | 705 | serialize_authz_record (const struct GNUNET_RECLAIM_Ticket *ticket, |
@@ -459,11 +811,11 @@ issue_ticket (struct TicketIssueHandle *ih) | |||
459 | 811 | ||
460 | 812 | ||
461 | void | 813 | void |
462 | RECLAIM_TICKETS_issue_ticket (const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, | 814 | RECLAIM_TICKETS_issue (const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, |
463 | const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs, | 815 | const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs, |
464 | const struct GNUNET_CRYPTO_EcdsaPublicKey *audience, | 816 | const struct GNUNET_CRYPTO_EcdsaPublicKey *audience, |
465 | RECLAIM_TICKETS_TicketResult cb, | 817 | RECLAIM_TICKETS_TicketResult cb, |
466 | void* cb_cls) | 818 | void* cb_cls) |
467 | { | 819 | { |
468 | struct TicketIssueHandle *tih; | 820 | struct TicketIssueHandle *tih; |
469 | tih = GNUNET_new (struct TicketIssueHandle); | 821 | tih = GNUNET_new (struct TicketIssueHandle); |
@@ -480,6 +832,9 @@ RECLAIM_TICKETS_issue_ticket (const struct GNUNET_CRYPTO_EcdsaPrivateKey *identi | |||
480 | issue_ticket (tih); | 832 | issue_ticket (tih); |
481 | } | 833 | } |
482 | 834 | ||
835 | /************************************ | ||
836 | * Ticket iteration | ||
837 | ************************************/ | ||
483 | 838 | ||
484 | static void | 839 | static void |
485 | cleanup_iter (struct RECLAIM_TICKETS_Iterator *iter) | 840 | cleanup_iter (struct RECLAIM_TICKETS_Iterator *iter) |
@@ -536,10 +891,10 @@ run_ticket_iteration_round (struct RECLAIM_TICKETS_Iterator *iter) | |||
536 | 891 | ||
537 | static void | 892 | static void |
538 | collect_tickets_cb (void *cls, | 893 | collect_tickets_cb (void *cls, |
539 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 894 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, |
540 | const char *label, | 895 | const char *label, |
541 | unsigned int rd_count, | 896 | unsigned int rd_count, |
542 | const struct GNUNET_GNSRECORD_Data *rd) | 897 | const struct GNUNET_GNSRECORD_Data *rd) |
543 | { | 898 | { |
544 | struct RECLAIM_TICKETS_Iterator *iter = cls; | 899 | struct RECLAIM_TICKETS_Iterator *iter = cls; |
545 | struct TicketReference *tr; | 900 | struct TicketReference *tr; |
@@ -628,10 +983,18 @@ RECLAIM_TICKETS_init (const struct GNUNET_CONFIGURATION_Handle *c) | |||
628 | nsh = GNUNET_NAMESTORE_connect (c); | 983 | nsh = GNUNET_NAMESTORE_connect (c); |
629 | if (NULL == nsh) | 984 | if (NULL == nsh) |
630 | { | 985 | { |
631 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 986 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, |
632 | "Error connecting to namestore\n"); | 987 | "error connecting to namestore"); |
633 | return GNUNET_SYSERR; | 988 | return GNUNET_SYSERR; |
634 | } | 989 | } |
990 | gns = GNUNET_GNS_connect (c); | ||
991 | if (NULL == gns) | ||
992 | { | ||
993 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, | ||
994 | "error connecting to gns"); | ||
995 | return GNUNET_SYSERR; | ||
996 | } | ||
997 | stats = GNUNET_STATISTICS_create ("reclaim", c); | ||
635 | return GNUNET_OK; | 998 | return GNUNET_OK; |
636 | } | 999 | } |
637 | 1000 | ||
@@ -641,4 +1004,12 @@ RECLAIM_TICKETS_deinit (void) | |||
641 | if (NULL != nsh) | 1004 | if (NULL != nsh) |
642 | GNUNET_NAMESTORE_disconnect (nsh); | 1005 | GNUNET_NAMESTORE_disconnect (nsh); |
643 | nsh = NULL; | 1006 | nsh = NULL; |
1007 | if (NULL != gns) | ||
1008 | GNUNET_GNS_disconnect (gns); | ||
1009 | gns = NULL; | ||
1010 | if (NULL != stats) | ||
1011 | { | ||
1012 | GNUNET_STATISTICS_destroy (stats, GNUNET_NO); | ||
1013 | stats = NULL; | ||
1014 | } | ||
644 | } | 1015 | } |