diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-08-15 21:54:06 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-08-15 21:54:06 +0000 |
commit | 5746309cb4be2073d550ad7a6885e918631dbc38 (patch) | |
tree | 89455bc4aadf977816b38df13f990372cd81d71a /src/fs/fs_namespace.c | |
parent | 6fd3e715cae09fa6e657c96f1c6f9711ee51f42f (diff) | |
download | gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.tar.gz gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.zip |
indentation
Diffstat (limited to 'src/fs/fs_namespace.c')
-rw-r--r-- | src/fs/fs_namespace.c | 163 |
1 files changed, 67 insertions, 96 deletions
diff --git a/src/fs/fs_namespace.c b/src/fs/fs_namespace.c index e8dd56ef4..236e8d59b 100644 --- a/src/fs/fs_namespace.c +++ b/src/fs/fs_namespace.c | |||
@@ -45,8 +45,8 @@ get_namespace_directory (struct GNUNET_FS_Handle *h) | |||
45 | char *dn; | 45 | char *dn; |
46 | 46 | ||
47 | if (GNUNET_OK != | 47 | if (GNUNET_OK != |
48 | GNUNET_CONFIGURATION_get_value_filename (h->cfg, | 48 | GNUNET_CONFIGURATION_get_value_filename (h->cfg, "FS", "IDENTITY_DIR", |
49 | "FS", "IDENTITY_DIR", &dn)) | 49 | &dn)) |
50 | { | 50 | { |
51 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 51 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
52 | _("Configuration fails to specify `%s' in section `%s'\n"), | 52 | _("Configuration fails to specify `%s' in section `%s'\n"), |
@@ -71,8 +71,8 @@ get_update_information_directory (struct GNUNET_FS_Namespace *ns) | |||
71 | char *ret; | 71 | char *ret; |
72 | 72 | ||
73 | if (GNUNET_OK != | 73 | if (GNUNET_OK != |
74 | GNUNET_CONFIGURATION_get_value_filename (ns->h->cfg, | 74 | GNUNET_CONFIGURATION_get_value_filename (ns->h->cfg, "FS", "UPDATE_DIR", |
75 | "FS", "UPDATE_DIR", &dn)) | 75 | &dn)) |
76 | { | 76 | { |
77 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 77 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
78 | _("Configuration fails to specify `%s' in section `%s'\n"), | 78 | _("Configuration fails to specify `%s' in section `%s'\n"), |
@@ -114,12 +114,9 @@ write_update_information_graph (struct GNUNET_FS_Namespace *ns) | |||
114 | { | 114 | { |
115 | n = ns->update_nodes[i]; | 115 | n = ns->update_nodes[i]; |
116 | uris = GNUNET_FS_uri_to_string (n->uri); | 116 | uris = GNUNET_FS_uri_to_string (n->uri); |
117 | if ((GNUNET_OK != | 117 | if ((GNUNET_OK != GNUNET_BIO_write_string (wh, n->id)) || |
118 | GNUNET_BIO_write_string (wh, n->id)) || | 118 | (GNUNET_OK != GNUNET_BIO_write_meta_data (wh, n->md)) || |
119 | (GNUNET_OK != | 119 | (GNUNET_OK != GNUNET_BIO_write_string (wh, n->update)) || |
120 | GNUNET_BIO_write_meta_data (wh, n->md)) || | ||
121 | (GNUNET_OK != | ||
122 | GNUNET_BIO_write_string (wh, n->update)) || | ||
123 | (GNUNET_OK != GNUNET_BIO_write_string (wh, uris))) | 120 | (GNUNET_OK != GNUNET_BIO_write_string (wh, uris))) |
124 | { | 121 | { |
125 | GNUNET_free (uris); | 122 | GNUNET_free (uris); |
@@ -129,8 +126,8 @@ write_update_information_graph (struct GNUNET_FS_Namespace *ns) | |||
129 | } | 126 | } |
130 | END: | 127 | END: |
131 | if (GNUNET_OK != GNUNET_BIO_write_close (wh)) | 128 | if (GNUNET_OK != GNUNET_BIO_write_close (wh)) |
132 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 129 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Failed to write `%s': %s\n"), |
133 | _("Failed to write `%s': %s\n"), STRERROR (errno)); | 130 | STRERROR (errno)); |
134 | GNUNET_free (fn); | 131 | GNUNET_free (fn); |
135 | } | 132 | } |
136 | 133 | ||
@@ -185,10 +182,8 @@ read_update_information_graph (struct GNUNET_FS_Namespace *ns) | |||
185 | for (i = 0; i < count; i++) | 182 | for (i = 0; i < count; i++) |
186 | { | 183 | { |
187 | n = GNUNET_malloc (sizeof (struct NamespaceUpdateNode)); | 184 | n = GNUNET_malloc (sizeof (struct NamespaceUpdateNode)); |
188 | if ((GNUNET_OK != | 185 | if ((GNUNET_OK != GNUNET_BIO_read_string (rh, "identifier", &n->id, 1024)) |
189 | GNUNET_BIO_read_string (rh, "identifier", &n->id, 1024)) || | 186 | || (GNUNET_OK != GNUNET_BIO_read_meta_data (rh, "meta", &n->md)) || |
190 | (GNUNET_OK != | ||
191 | GNUNET_BIO_read_meta_data (rh, "meta", &n->md)) || | ||
192 | (GNUNET_OK != | 187 | (GNUNET_OK != |
193 | GNUNET_BIO_read_string (rh, "update-id", &n->update, 1024)) || | 188 | GNUNET_BIO_read_string (rh, "update-id", &n->update, 1024)) || |
194 | (GNUNET_OK != GNUNET_BIO_read_string (rh, "uri", &uris, 1024 * 2))) | 189 | (GNUNET_OK != GNUNET_BIO_read_string (rh, "uri", &uris, 1024 * 2))) |
@@ -320,8 +315,7 @@ advertisement_cont (void *cls, int success, const char *msg) | |||
320 | if (GNUNET_OK != success) | 315 | if (GNUNET_OK != success) |
321 | { | 316 | { |
322 | /* error! */ | 317 | /* error! */ |
323 | GNUNET_SCHEDULER_add_continuation (&do_disconnect, | 318 | GNUNET_SCHEDULER_add_continuation (&do_disconnect, ac->dsh, |
324 | ac->dsh, | ||
325 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 319 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
326 | if (msg == NULL) | 320 | if (msg == NULL) |
327 | { | 321 | { |
@@ -340,8 +334,7 @@ advertisement_cont (void *cls, int success, const char *msg) | |||
340 | if (ac->pos == ac->ksk_uri->data.ksk.keywordCount) | 334 | if (ac->pos == ac->ksk_uri->data.ksk.keywordCount) |
341 | { | 335 | { |
342 | /* done! */ | 336 | /* done! */ |
343 | GNUNET_SCHEDULER_add_continuation (&do_disconnect, | 337 | GNUNET_SCHEDULER_add_continuation (&do_disconnect, ac->dsh, |
344 | ac->dsh, | ||
345 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 338 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
346 | if (ac->cont != NULL) | 339 | if (ac->cont != NULL) |
347 | ac->cont (ac->cont_cls, ac->ksk_uri, NULL); | 340 | ac->cont (ac->cont_cls, ac->ksk_uri, NULL); |
@@ -359,8 +352,7 @@ advertisement_cont (void *cls, int success, const char *msg) | |||
359 | GNUNET_CRYPTO_hash_to_aes_key (&key, &skey, &iv); | 352 | GNUNET_CRYPTO_hash_to_aes_key (&key, &skey, &iv); |
360 | GNUNET_CRYPTO_aes_encrypt (ac->pt, ac->pt_size, &skey, &iv, &ac->nb[1]); | 353 | GNUNET_CRYPTO_aes_encrypt (ac->pt, ac->pt_size, &skey, &iv, &ac->nb[1]); |
361 | GNUNET_break (GNUNET_OK == | 354 | GNUNET_break (GNUNET_OK == |
362 | GNUNET_CRYPTO_rsa_sign (ac->ns->key, | 355 | GNUNET_CRYPTO_rsa_sign (ac->ns->key, &ac->nb->ns_purpose, |
363 | &ac->nb->ns_purpose, | ||
364 | &ac->nb->ns_signature)); | 356 | &ac->nb->ns_signature)); |
365 | pk = GNUNET_CRYPTO_rsa_key_create_from_hash (&key); | 357 | pk = GNUNET_CRYPTO_rsa_key_create_from_hash (&key); |
366 | GNUNET_assert (pk != NULL); | 358 | GNUNET_assert (pk != NULL); |
@@ -369,22 +361,16 @@ advertisement_cont (void *cls, int success, const char *msg) | |||
369 | sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), | 361 | sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), |
370 | &query); | 362 | &query); |
371 | GNUNET_break (GNUNET_OK == | 363 | GNUNET_break (GNUNET_OK == |
372 | GNUNET_CRYPTO_rsa_sign (pk, | 364 | GNUNET_CRYPTO_rsa_sign (pk, &ac->nb->ksk_purpose, |
373 | &ac->nb->ksk_purpose, | ||
374 | &ac->nb->ksk_signature)); | 365 | &ac->nb->ksk_signature)); |
375 | GNUNET_CRYPTO_rsa_key_free (pk); | 366 | GNUNET_CRYPTO_rsa_key_free (pk); |
376 | GNUNET_DATASTORE_put (ac->dsh, 0 /* no reservation */ , | 367 | GNUNET_DATASTORE_put (ac->dsh, 0 /* no reservation */ , |
377 | &query, | 368 | &query, ac->pt_size + sizeof (struct NBlock), ac->nb, |
378 | ac->pt_size + sizeof (struct NBlock), | 369 | GNUNET_BLOCK_TYPE_FS_NBLOCK, ac->bo.content_priority, |
379 | ac->nb, | 370 | ac->bo.anonymity_level, ac->bo.replication_level, |
380 | GNUNET_BLOCK_TYPE_FS_NBLOCK, | 371 | ac->bo.expiration_time, -2, 1, |
381 | ac->bo.content_priority, | 372 | GNUNET_CONSTANTS_SERVICE_TIMEOUT, &advertisement_cont, |
382 | ac->bo.anonymity_level, | 373 | ac); |
383 | ac->bo.replication_level, | ||
384 | ac->bo.expiration_time, | ||
385 | -2, 1, | ||
386 | GNUNET_CONSTANTS_SERVICE_TIMEOUT, | ||
387 | &advertisement_cont, ac); | ||
388 | } | 374 | } |
389 | 375 | ||
390 | 376 | ||
@@ -437,10 +423,9 @@ GNUNET_FS_namespace_advertise (struct GNUNET_FS_Handle *h, | |||
437 | pt = GNUNET_malloc (mdsize + reslen); | 423 | pt = GNUNET_malloc (mdsize + reslen); |
438 | memcpy (pt, rootEntry, reslen); | 424 | memcpy (pt, rootEntry, reslen); |
439 | mdst = &pt[reslen]; | 425 | mdst = &pt[reslen]; |
440 | mdsize = GNUNET_CONTAINER_meta_data_serialize (meta, | 426 | mdsize = |
441 | &mdst, | 427 | GNUNET_CONTAINER_meta_data_serialize (meta, &mdst, mdsize, |
442 | mdsize, | 428 | GNUNET_CONTAINER_META_DATA_SERIALIZE_PART); |
443 | GNUNET_CONTAINER_META_DATA_SERIALIZE_PART); | ||
444 | if (mdsize == -1) | 429 | if (mdsize == -1) |
445 | { | 430 | { |
446 | GNUNET_break (0); | 431 | GNUNET_break (0); |
@@ -451,11 +436,10 @@ GNUNET_FS_namespace_advertise (struct GNUNET_FS_Handle *h, | |||
451 | size = mdsize + sizeof (struct NBlock) + reslen; | 436 | size = mdsize + sizeof (struct NBlock) + reslen; |
452 | nb = GNUNET_malloc (size); | 437 | nb = GNUNET_malloc (size); |
453 | GNUNET_CRYPTO_rsa_key_get_public (namespace->key, &nb->subspace); | 438 | GNUNET_CRYPTO_rsa_key_get_public (namespace->key, &nb->subspace); |
454 | nb->ns_purpose.size = htonl (mdsize + reslen + | 439 | nb->ns_purpose.size = |
455 | sizeof (struct GNUNET_CRYPTO_RsaSignaturePurpose) | 440 | htonl (mdsize + reslen + |
456 | + | 441 | sizeof (struct GNUNET_CRYPTO_RsaSignaturePurpose) + |
457 | sizeof (struct | 442 | sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded)); |
458 | GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded)); | ||
459 | nb->ns_purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_FS_NBLOCK); | 443 | nb->ns_purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_FS_NBLOCK); |
460 | nb->ksk_purpose.size = | 444 | nb->ksk_purpose.size = |
461 | htonl (size - sizeof (struct GNUNET_CRYPTO_RsaSignature)); | 445 | htonl (size - sizeof (struct GNUNET_CRYPTO_RsaSignature)); |
@@ -541,8 +525,8 @@ GNUNET_FS_namespace_delete (struct GNUNET_FS_Namespace *namespace, int freeze) | |||
541 | if (freeze) | 525 | if (freeze) |
542 | { | 526 | { |
543 | if (0 != UNLINK (namespace->filename)) | 527 | if (0 != UNLINK (namespace->filename)) |
544 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, | 528 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "unlink", |
545 | "unlink", namespace->filename); | 529 | namespace->filename); |
546 | } | 530 | } |
547 | if (0 == namespace->rc) | 531 | if (0 == namespace->rc) |
548 | { | 532 | { |
@@ -558,8 +542,8 @@ GNUNET_FS_namespace_delete (struct GNUNET_FS_Namespace *namespace, int freeze) | |||
558 | GNUNET_free (nsn->update); | 542 | GNUNET_free (nsn->update); |
559 | GNUNET_free (nsn); | 543 | GNUNET_free (nsn); |
560 | } | 544 | } |
561 | GNUNET_array_grow (namespace->update_nodes, | 545 | GNUNET_array_grow (namespace->update_nodes, namespace->update_node_count, |
562 | namespace->update_node_count, 0); | 546 | 0); |
563 | if (namespace->update_map != NULL) | 547 | if (namespace->update_map != NULL) |
564 | GNUNET_CONTAINER_multihashmap_destroy (namespace->update_map); | 548 | GNUNET_CONTAINER_multihashmap_destroy (namespace->update_map); |
565 | GNUNET_free (namespace); | 549 | GNUNET_free (namespace); |
@@ -733,8 +717,7 @@ sb_put_cont (void *cls, int success, const char *msg) | |||
733 | if (psc->namespace->update_map != NULL) | 717 | if (psc->namespace->update_map != NULL) |
734 | { | 718 | { |
735 | GNUNET_CRYPTO_hash (psc->nsn->id, strlen (psc->nsn->id), &hc); | 719 | GNUNET_CRYPTO_hash (psc->nsn->id, strlen (psc->nsn->id), &hc); |
736 | GNUNET_CONTAINER_multihashmap_put (psc->namespace->update_map, | 720 | GNUNET_CONTAINER_multihashmap_put (psc->namespace->update_map, &hc, |
737 | &hc, | ||
738 | psc->nsn, | 721 | psc->nsn, |
739 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 722 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
740 | } | 723 | } |
@@ -775,8 +758,7 @@ sb_put_cont (void *cls, int success, const char *msg) | |||
775 | void | 758 | void |
776 | GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, | 759 | GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, |
777 | struct GNUNET_FS_Namespace *namespace, | 760 | struct GNUNET_FS_Namespace *namespace, |
778 | const char *identifier, | 761 | const char *identifier, const char *update, |
779 | const char *update, | ||
780 | const struct GNUNET_CONTAINER_MetaData *meta, | 762 | const struct GNUNET_CONTAINER_MetaData *meta, |
781 | const struct GNUNET_FS_Uri *uri, | 763 | const struct GNUNET_FS_Uri *uri, |
782 | const struct GNUNET_FS_BlockOptions *bo, | 764 | const struct GNUNET_FS_BlockOptions *bo, |
@@ -829,10 +811,9 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, | |||
829 | memcpy (dest, uris, slen); | 811 | memcpy (dest, uris, slen); |
830 | GNUNET_free (uris); | 812 | GNUNET_free (uris); |
831 | dest += slen; | 813 | dest += slen; |
832 | mdsize = GNUNET_CONTAINER_meta_data_serialize (mmeta, | 814 | mdsize = |
833 | &dest, | 815 | GNUNET_CONTAINER_meta_data_serialize (mmeta, &dest, mdsize, |
834 | mdsize, | 816 | GNUNET_CONTAINER_META_DATA_SERIALIZE_PART); |
835 | GNUNET_CONTAINER_META_DATA_SERIALIZE_PART); | ||
836 | GNUNET_CONTAINER_meta_data_destroy (mmeta); | 817 | GNUNET_CONTAINER_meta_data_destroy (mmeta); |
837 | if (mdsize == -1) | 818 | if (mdsize == -1) |
838 | { | 819 | { |
@@ -852,19 +833,18 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, | |||
852 | sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), | 833 | sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), |
853 | &sks_uri->data.sks.namespace); | 834 | &sks_uri->data.sks.namespace); |
854 | sks_uri->data.sks.identifier = GNUNET_strdup (identifier); | 835 | sks_uri->data.sks.identifier = GNUNET_strdup (identifier); |
855 | GNUNET_CRYPTO_hash_xor (&id, | 836 | GNUNET_CRYPTO_hash_xor (&id, &sks_uri->data.sks.namespace, |
856 | &sks_uri->data.sks.namespace, &sb_enc->identifier); | 837 | &sb_enc->identifier); |
857 | GNUNET_CRYPTO_hash_to_aes_key (&key, &sk, &iv); | 838 | GNUNET_CRYPTO_hash_to_aes_key (&key, &sk, &iv); |
858 | GNUNET_CRYPTO_aes_encrypt (&sb[1], | 839 | GNUNET_CRYPTO_aes_encrypt (&sb[1], size - sizeof (struct SBlock), &sk, &iv, |
859 | size - sizeof (struct SBlock), | 840 | &sb_enc[1]); |
860 | &sk, &iv, &sb_enc[1]); | ||
861 | sb_enc->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_FS_SBLOCK); | 841 | sb_enc->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_FS_SBLOCK); |
862 | sb_enc->purpose.size = htonl (slen + mdsize + nidlen | 842 | sb_enc->purpose.size = |
863 | + sizeof (struct SBlock) | 843 | htonl (slen + mdsize + nidlen + sizeof (struct SBlock) - |
864 | - sizeof (struct GNUNET_CRYPTO_RsaSignature)); | 844 | sizeof (struct GNUNET_CRYPTO_RsaSignature)); |
865 | GNUNET_assert (GNUNET_OK == | 845 | GNUNET_assert (GNUNET_OK == |
866 | GNUNET_CRYPTO_rsa_sign (namespace->key, | 846 | GNUNET_CRYPTO_rsa_sign (namespace->key, &sb_enc->purpose, |
867 | &sb_enc->purpose, &sb_enc->signature)); | 847 | &sb_enc->signature)); |
868 | psc = GNUNET_malloc (sizeof (struct PublishSksContext)); | 848 | psc = GNUNET_malloc (sizeof (struct PublishSksContext)); |
869 | psc->uri = sks_uri; | 849 | psc->uri = sks_uri; |
870 | psc->cont = cont; | 850 | psc->cont = cont; |
@@ -895,17 +875,10 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, | |||
895 | psc->nsn->md = GNUNET_CONTAINER_meta_data_duplicate (meta); | 875 | psc->nsn->md = GNUNET_CONTAINER_meta_data_duplicate (meta); |
896 | psc->nsn->uri = GNUNET_FS_uri_dup (uri); | 876 | psc->nsn->uri = GNUNET_FS_uri_dup (uri); |
897 | } | 877 | } |
898 | GNUNET_DATASTORE_put (psc->dsh, | 878 | GNUNET_DATASTORE_put (psc->dsh, 0, &sb_enc->identifier, size, sb_enc, |
899 | 0, | 879 | GNUNET_BLOCK_TYPE_FS_SBLOCK, bo->content_priority, |
900 | &sb_enc->identifier, | 880 | bo->anonymity_level, bo->replication_level, |
901 | size, | 881 | bo->expiration_time, -2, 1, |
902 | sb_enc, | ||
903 | GNUNET_BLOCK_TYPE_FS_SBLOCK, | ||
904 | bo->content_priority, | ||
905 | bo->anonymity_level, | ||
906 | bo->replication_level, | ||
907 | bo->expiration_time, | ||
908 | -2, 1, | ||
909 | GNUNET_CONSTANTS_SERVICE_TIMEOUT, &sb_put_cont, psc); | 882 | GNUNET_CONSTANTS_SERVICE_TIMEOUT, &sb_put_cont, psc); |
910 | GNUNET_free (sb); | 883 | GNUNET_free (sb); |
911 | GNUNET_free (sb_enc); | 884 | GNUNET_free (sb_enc); |
@@ -1030,8 +1003,8 @@ find_trees (void *cls, const GNUNET_HashCode * key, void *value) | |||
1030 | nsn->tree_id = UINT_MAX; /* mark as undef */ | 1003 | nsn->tree_id = UINT_MAX; /* mark as undef */ |
1031 | /* trace */ | 1004 | /* trace */ |
1032 | GNUNET_CRYPTO_hash (nsn->update, strlen (nsn->update), &hc); | 1005 | GNUNET_CRYPTO_hash (nsn->update, strlen (nsn->update), &hc); |
1033 | GNUNET_CONTAINER_multihashmap_get_multiple (fc->namespace->update_map, | 1006 | GNUNET_CONTAINER_multihashmap_get_multiple (fc->namespace->update_map, &hc, |
1034 | &hc, &find_trees, fc); | 1007 | &find_trees, fc); |
1035 | } | 1008 | } |
1036 | return GNUNET_YES; | 1009 | return GNUNET_YES; |
1037 | } | 1010 | } |
@@ -1093,9 +1066,7 @@ GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Namespace *namespace, | |||
1093 | { | 1066 | { |
1094 | nsn = namespace->update_nodes[i]; | 1067 | nsn = namespace->update_nodes[i]; |
1095 | GNUNET_CRYPTO_hash (nsn->id, strlen (nsn->id), &hc); | 1068 | GNUNET_CRYPTO_hash (nsn->id, strlen (nsn->id), &hc); |
1096 | GNUNET_CONTAINER_multihashmap_put (namespace->update_map, | 1069 | GNUNET_CONTAINER_multihashmap_put (namespace->update_map, &hc, nsn, |
1097 | &hc, | ||
1098 | nsn, | ||
1099 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 1070 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
1100 | } | 1071 | } |
1101 | } | 1072 | } |
@@ -1104,8 +1075,8 @@ GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Namespace *namespace, | |||
1104 | GNUNET_CRYPTO_hash (next_id, strlen (next_id), &hc); | 1075 | GNUNET_CRYPTO_hash (next_id, strlen (next_id), &hc); |
1105 | pc.ip = ip; | 1076 | pc.ip = ip; |
1106 | pc.ip_cls = ip_cls; | 1077 | pc.ip_cls = ip_cls; |
1107 | GNUNET_CONTAINER_multihashmap_get_multiple (namespace->update_map, | 1078 | GNUNET_CONTAINER_multihashmap_get_multiple (namespace->update_map, &hc, |
1108 | &hc, &process_update_node, &pc); | 1079 | &process_update_node, &pc); |
1109 | return; | 1080 | return; |
1110 | } | 1081 | } |
1111 | #if DEBUG_NAMESPACE | 1082 | #if DEBUG_NAMESPACE |
@@ -1123,8 +1094,8 @@ GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Namespace *namespace, | |||
1123 | if (nsn->nug == nug) | 1094 | if (nsn->nug == nug) |
1124 | { | 1095 | { |
1125 | #if DEBUG_NAMESPACE | 1096 | #if DEBUG_NAMESPACE |
1126 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1097 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "TREE of node `%s' is %u\n", nsn->id, |
1127 | "TREE of node `%s' is %u\n", nsn->id, nsn->nug); | 1098 | nsn->nug); |
1128 | #endif | 1099 | #endif |
1129 | continue; /* already placed in TREE */ | 1100 | continue; /* already placed in TREE */ |
1130 | } | 1101 | } |
@@ -1133,8 +1104,8 @@ GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Namespace *namespace, | |||
1133 | fc.id = UINT_MAX; | 1104 | fc.id = UINT_MAX; |
1134 | fc.nug = nug; | 1105 | fc.nug = nug; |
1135 | fc.namespace = namespace; | 1106 | fc.namespace = namespace; |
1136 | GNUNET_CONTAINER_multihashmap_get_multiple (namespace->update_map, | 1107 | GNUNET_CONTAINER_multihashmap_get_multiple (namespace->update_map, &hc, |
1137 | &hc, &find_trees, &fc); | 1108 | &find_trees, &fc); |
1138 | if (fc.id == UINT_MAX) | 1109 | if (fc.id == UINT_MAX) |
1139 | { | 1110 | { |
1140 | /* start new TREE */ | 1111 | /* start new TREE */ |
@@ -1154,16 +1125,16 @@ GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Namespace *namespace, | |||
1154 | } | 1125 | } |
1155 | #if DEBUG_NAMESPACE | 1126 | #if DEBUG_NAMESPACE |
1156 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1127 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1157 | "Starting new TREE %u with node `%s'\n", | 1128 | "Starting new TREE %u with node `%s'\n", nsn->tree_id, |
1158 | nsn->tree_id, nsn->id); | 1129 | nsn->id); |
1159 | #endif | 1130 | #endif |
1160 | /* put all nodes with same identifier into this TREE */ | 1131 | /* put all nodes with same identifier into this TREE */ |
1161 | GNUNET_CRYPTO_hash (nsn->id, strlen (nsn->id), &hc); | 1132 | GNUNET_CRYPTO_hash (nsn->id, strlen (nsn->id), &hc); |
1162 | fc.id = nsn->tree_id; | 1133 | fc.id = nsn->tree_id; |
1163 | fc.nug = nug; | 1134 | fc.nug = nug; |
1164 | fc.namespace = namespace; | 1135 | fc.namespace = namespace; |
1165 | GNUNET_CONTAINER_multihashmap_get_multiple (namespace->update_map, | 1136 | GNUNET_CONTAINER_multihashmap_get_multiple (namespace->update_map, &hc, |
1166 | &hc, &find_trees, &fc); | 1137 | &find_trees, &fc); |
1167 | } | 1138 | } |
1168 | else | 1139 | else |
1169 | { | 1140 | { |
@@ -1172,8 +1143,8 @@ GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Namespace *namespace, | |||
1172 | nsn->tree_id = fc.id; | 1143 | nsn->tree_id = fc.id; |
1173 | } | 1144 | } |
1174 | #if DEBUG_NAMESPACE | 1145 | #if DEBUG_NAMESPACE |
1175 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1146 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "TREE of node `%s' is %u\n", nsn->id, |
1176 | "TREE of node `%s' is %u\n", nsn->id, fc.id); | 1147 | fc.id); |
1177 | #endif | 1148 | #endif |
1178 | } | 1149 | } |
1179 | for (i = 0; i < fc.tree_array_size; i++) | 1150 | for (i = 0; i < fc.tree_array_size; i++) |
@@ -1182,8 +1153,8 @@ GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Namespace *namespace, | |||
1182 | if (NULL != nsn) | 1153 | if (NULL != nsn) |
1183 | { | 1154 | { |
1184 | #if DEBUG_NAMESPACE | 1155 | #if DEBUG_NAMESPACE |
1185 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1156 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Root of TREE %u is node `%s'\n", i, |
1186 | "Root of TREE %u is node `%s'\n", i, nsn->id); | 1157 | nsn->id); |
1187 | #endif | 1158 | #endif |
1188 | 1159 | ||
1189 | ip (ip_cls, nsn->id, nsn->uri, nsn->md, nsn->update); | 1160 | ip (ip_cls, nsn->id, nsn->uri, nsn->md, nsn->update); |