diff options
Diffstat (limited to 'src/fs/fs_namespace.c')
-rw-r--r-- | src/fs/fs_namespace.c | 188 |
1 files changed, 96 insertions, 92 deletions
diff --git a/src/fs/fs_namespace.c b/src/fs/fs_namespace.c index 675253b90..11a137a09 100644 --- a/src/fs/fs_namespace.c +++ b/src/fs/fs_namespace.c | |||
@@ -69,7 +69,6 @@ struct NamespaceUpdateNode | |||
69 | * TREE this entry belongs to (if nug is current). | 69 | * TREE this entry belongs to (if nug is current). |
70 | */ | 70 | */ |
71 | unsigned int tree_id; | 71 | unsigned int tree_id; |
72 | |||
73 | }; | 72 | }; |
74 | 73 | ||
75 | 74 | ||
@@ -126,8 +125,9 @@ struct GNUNET_FS_UpdateInformationGraph | |||
126 | * @return NULL on error, otherwise the name of the directory | 125 | * @return NULL on error, otherwise the name of the directory |
127 | */ | 126 | */ |
128 | static char * | 127 | static char * |
129 | get_update_information_directory (struct GNUNET_FS_Handle *h, | 128 | get_update_information_directory ( |
130 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns) | 129 | struct GNUNET_FS_Handle *h, |
130 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns) | ||
131 | { | 131 | { |
132 | char *dn; | 132 | char *dn; |
133 | char *ret; | 133 | char *ret; |
@@ -136,21 +136,19 @@ get_update_information_directory (struct GNUNET_FS_Handle *h, | |||
136 | struct GNUNET_CRYPTO_HashAsciiEncoded enc; | 136 | struct GNUNET_CRYPTO_HashAsciiEncoded enc; |
137 | 137 | ||
138 | if (GNUNET_OK != | 138 | if (GNUNET_OK != |
139 | GNUNET_CONFIGURATION_get_value_filename (h->cfg, "FS", "UPDATE_DIR", | 139 | GNUNET_CONFIGURATION_get_value_filename (h->cfg, "FS", "UPDATE_DIR", &dn)) |
140 | &dn)) | ||
141 | { | 140 | { |
142 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, | 141 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "fs", "UPDATE_DIR"); |
143 | "fs", "UPDATE_DIR"); | ||
144 | return NULL; | 142 | return NULL; |
145 | } | 143 | } |
146 | GNUNET_CRYPTO_ecdsa_key_get_public (ns, &pub); | 144 | GNUNET_CRYPTO_ecdsa_key_get_public (ns, &pub); |
147 | GNUNET_CRYPTO_hash (&pub, sizeof (pub), &hc); | 145 | GNUNET_CRYPTO_hash (&pub, sizeof (pub), &hc); |
148 | GNUNET_CRYPTO_hash_to_enc (&hc, | 146 | GNUNET_CRYPTO_hash_to_enc (&hc, &enc); |
149 | &enc); | 147 | GNUNET_asprintf (&ret, |
150 | GNUNET_asprintf (&ret, "%s%s%s", | 148 | "%s%s%s", |
151 | dn, | 149 | dn, |
152 | DIR_SEPARATOR_STR, | 150 | DIR_SEPARATOR_STR, |
153 | (const char *) enc.encoding); | 151 | (const char *) enc.encoding); |
154 | GNUNET_free (dn); | 152 | GNUNET_free (dn); |
155 | return ret; | 153 | return ret; |
156 | } | 154 | } |
@@ -176,8 +174,7 @@ free_update_information_graph (struct GNUNET_FS_UpdateInformationGraph *uig) | |||
176 | GNUNET_free (nsn->update); | 174 | GNUNET_free (nsn->update); |
177 | GNUNET_free (nsn); | 175 | GNUNET_free (nsn); |
178 | } | 176 | } |
179 | GNUNET_array_grow (uig->update_nodes, uig->update_node_count, | 177 | GNUNET_array_grow (uig->update_nodes, uig->update_node_count, 0); |
180 | 0); | ||
181 | if (NULL != uig->update_map) | 178 | if (NULL != uig->update_map) |
182 | GNUNET_CONTAINER_multihashmap_destroy (uig->update_map); | 179 | GNUNET_CONTAINER_multihashmap_destroy (uig->update_map); |
183 | GNUNET_free (uig); | 180 | GNUNET_free (uig); |
@@ -198,15 +195,14 @@ write_update_information_graph (struct GNUNET_FS_UpdateInformationGraph *uig) | |||
198 | struct NamespaceUpdateNode *n; | 195 | struct NamespaceUpdateNode *n; |
199 | char *uris; | 196 | char *uris; |
200 | 197 | ||
201 | fn = get_update_information_directory (uig->h, | 198 | fn = get_update_information_directory (uig->h, &uig->ns); |
202 | &uig->ns); | ||
203 | wh = GNUNET_BIO_write_open (fn); | 199 | wh = GNUNET_BIO_write_open (fn); |
204 | if (NULL == wh) | 200 | if (NULL == wh) |
205 | { | 201 | { |
206 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 202 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
207 | _("Failed to open `%s' for writing: %s\n"), | 203 | _ ("Failed to open `%s' for writing: %s\n"), |
208 | fn, | 204 | fn, |
209 | STRERROR (errno)); | 205 | strerror (errno)); |
210 | GNUNET_free (fn); | 206 | GNUNET_free (fn); |
211 | return; | 207 | return; |
212 | } | 208 | } |
@@ -229,9 +225,9 @@ write_update_information_graph (struct GNUNET_FS_UpdateInformationGraph *uig) | |||
229 | END: | 225 | END: |
230 | if (GNUNET_OK != GNUNET_BIO_write_close (wh)) | 226 | if (GNUNET_OK != GNUNET_BIO_write_close (wh)) |
231 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 227 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
232 | _("Failed to write `%s': %s\n"), | 228 | _ ("Failed to write `%s': %s\n"), |
233 | fn, | 229 | fn, |
234 | STRERROR (errno)); | 230 | strerror (errno)); |
235 | GNUNET_free (fn); | 231 | GNUNET_free (fn); |
236 | } | 232 | } |
237 | 233 | ||
@@ -245,7 +241,7 @@ END: | |||
245 | */ | 241 | */ |
246 | static struct GNUNET_FS_UpdateInformationGraph * | 242 | static struct GNUNET_FS_UpdateInformationGraph * |
247 | read_update_information_graph (struct GNUNET_FS_Handle *h, | 243 | read_update_information_graph (struct GNUNET_FS_Handle *h, |
248 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns) | 244 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns) |
249 | { | 245 | { |
250 | struct GNUNET_FS_UpdateInformationGraph *uig; | 246 | struct GNUNET_FS_UpdateInformationGraph *uig; |
251 | char *fn; | 247 | char *fn; |
@@ -289,8 +285,9 @@ read_update_information_graph (struct GNUNET_FS_Handle *h, | |||
289 | for (i = 0; i < count; i++) | 285 | for (i = 0; i < count; i++) |
290 | { | 286 | { |
291 | n = GNUNET_new (struct NamespaceUpdateNode); | 287 | n = GNUNET_new (struct NamespaceUpdateNode); |
292 | if ((GNUNET_OK != GNUNET_BIO_read_string (rh, "identifier", &n->id, 1024)) | 288 | if ((GNUNET_OK != |
293 | || (GNUNET_OK != GNUNET_BIO_read_meta_data (rh, "meta", &n->md)) || | 289 | GNUNET_BIO_read_string (rh, "identifier", &n->id, 1024)) || |
290 | (GNUNET_OK != GNUNET_BIO_read_meta_data (rh, "meta", &n->md)) || | ||
294 | (GNUNET_OK != | 291 | (GNUNET_OK != |
295 | GNUNET_BIO_read_string (rh, "update-id", &n->update, 1024)) || | 292 | GNUNET_BIO_read_string (rh, "update-id", &n->update, 1024)) || |
296 | (GNUNET_OK != GNUNET_BIO_read_string (rh, "uri", &uris, 1024 * 2))) | 293 | (GNUNET_OK != GNUNET_BIO_read_string (rh, "uri", &uris, 1024 * 2))) |
@@ -318,11 +315,13 @@ read_update_information_graph (struct GNUNET_FS_Handle *h, | |||
318 | uig->update_nodes[i] = n; | 315 | uig->update_nodes[i] = n; |
319 | } | 316 | } |
320 | uig->update_node_count = i; | 317 | uig->update_node_count = i; |
321 | END: | 318 | END: |
322 | if (GNUNET_OK != GNUNET_BIO_read_close (rh, &emsg)) | 319 | if (GNUNET_OK != GNUNET_BIO_read_close (rh, &emsg)) |
323 | { | 320 | { |
324 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Failed to read `%s': %s\n"), | 321 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
325 | fn, emsg); | 322 | _ ("Failed to read `%s': %s\n"), |
323 | fn, | ||
324 | emsg); | ||
326 | GNUNET_free (emsg); | 325 | GNUNET_free (emsg); |
327 | } | 326 | } |
328 | GNUNET_free (fn); | 327 | GNUNET_free (fn); |
@@ -387,8 +386,7 @@ struct GNUNET_FS_PublishSksContext | |||
387 | * @param msg error message (or NULL) | 386 | * @param msg error message (or NULL) |
388 | */ | 387 | */ |
389 | static void | 388 | static void |
390 | sks_publish_cont (void *cls, | 389 | sks_publish_cont (void *cls, const char *msg) |
391 | const char *msg) | ||
392 | { | 390 | { |
393 | struct GNUNET_FS_PublishSksContext *psc = cls; | 391 | struct GNUNET_FS_PublishSksContext *psc = cls; |
394 | struct GNUNET_FS_UpdateInformationGraph *uig; | 392 | struct GNUNET_FS_UpdateInformationGraph *uig; |
@@ -406,11 +404,8 @@ sks_publish_cont (void *cls, | |||
406 | /* FIXME: this can be done much more | 404 | /* FIXME: this can be done much more |
407 | * efficiently by simply appending to the | 405 | * efficiently by simply appending to the |
408 | * file and overwriting the 4-byte header */ | 406 | * file and overwriting the 4-byte header */ |
409 | uig = read_update_information_graph (psc->h, | 407 | uig = read_update_information_graph (psc->h, &psc->ns); |
410 | &psc->ns); | 408 | GNUNET_array_append (uig->update_nodes, uig->update_node_count, psc->nsn); |
411 | GNUNET_array_append (uig->update_nodes, | ||
412 | uig->update_node_count, | ||
413 | psc->nsn); | ||
414 | psc->nsn = NULL; | 409 | psc->nsn = NULL; |
415 | write_update_information_graph (uig); | 410 | write_update_information_graph (uig); |
416 | free_update_information_graph (uig); | 411 | free_update_information_graph (uig); |
@@ -439,12 +434,14 @@ sks_publish_cont (void *cls, | |||
439 | struct GNUNET_FS_PublishSksContext * | 434 | struct GNUNET_FS_PublishSksContext * |
440 | GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, | 435 | GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, |
441 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns, | 436 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns, |
442 | const char *identifier, const char *update, | 437 | const char *identifier, |
438 | const char *update, | ||
443 | const struct GNUNET_CONTAINER_MetaData *meta, | 439 | const struct GNUNET_CONTAINER_MetaData *meta, |
444 | const struct GNUNET_FS_Uri *uri, | 440 | const struct GNUNET_FS_Uri *uri, |
445 | const struct GNUNET_FS_BlockOptions *bo, | 441 | const struct GNUNET_FS_BlockOptions *bo, |
446 | enum GNUNET_FS_PublishOptions options, | 442 | enum GNUNET_FS_PublishOptions options, |
447 | GNUNET_FS_PublishContinuation cont, void *cont_cls) | 443 | GNUNET_FS_PublishContinuation cont, |
444 | void *cont_cls) | ||
448 | { | 445 | { |
449 | struct GNUNET_FS_PublishSksContext *psc; | 446 | struct GNUNET_FS_PublishSksContext *psc; |
450 | struct GNUNET_FS_Uri *sks_uri; | 447 | struct GNUNET_FS_Uri *sks_uri; |
@@ -452,8 +449,7 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, | |||
452 | sks_uri = GNUNET_new (struct GNUNET_FS_Uri); | 449 | sks_uri = GNUNET_new (struct GNUNET_FS_Uri); |
453 | sks_uri->type = GNUNET_FS_URI_SKS; | 450 | sks_uri->type = GNUNET_FS_URI_SKS; |
454 | sks_uri->data.sks.identifier = GNUNET_strdup (identifier); | 451 | sks_uri->data.sks.identifier = GNUNET_strdup (identifier); |
455 | GNUNET_CRYPTO_ecdsa_key_get_public (ns, | 452 | GNUNET_CRYPTO_ecdsa_key_get_public (ns, &sks_uri->data.sks.ns); |
456 | &sks_uri->data.sks.ns); | ||
457 | 453 | ||
458 | psc = GNUNET_new (struct GNUNET_FS_PublishSksContext); | 454 | psc = GNUNET_new (struct GNUNET_FS_PublishSksContext); |
459 | psc->h = h; | 455 | psc->h = h; |
@@ -466,8 +462,7 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, | |||
466 | psc->dsh = GNUNET_DATASTORE_connect (h->cfg); | 462 | psc->dsh = GNUNET_DATASTORE_connect (h->cfg); |
467 | if (NULL == psc->dsh) | 463 | if (NULL == psc->dsh) |
468 | { | 464 | { |
469 | sks_publish_cont (psc, | 465 | sks_publish_cont (psc, _ ("Failed to connect to datastore.")); |
470 | _("Failed to connect to datastore.")); | ||
471 | return NULL; | 466 | return NULL; |
472 | } | 467 | } |
473 | } | 468 | } |
@@ -480,16 +475,16 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, | |||
480 | psc->nsn->uri = GNUNET_FS_uri_dup (uri); | 475 | psc->nsn->uri = GNUNET_FS_uri_dup (uri); |
481 | } | 476 | } |
482 | psc->uc = GNUNET_FS_publish_ublock_ (h, | 477 | psc->uc = GNUNET_FS_publish_ublock_ (h, |
483 | psc->dsh, | 478 | psc->dsh, |
484 | identifier, | 479 | identifier, |
485 | update, | 480 | update, |
486 | ns, | 481 | ns, |
487 | meta, | 482 | meta, |
488 | uri, | 483 | uri, |
489 | bo, | 484 | bo, |
490 | options, | 485 | options, |
491 | &sks_publish_cont, | 486 | &sks_publish_cont, |
492 | psc); | 487 | psc); |
493 | return psc; | 488 | return psc; |
494 | } | 489 | } |
495 | 490 | ||
@@ -553,18 +548,12 @@ struct ProcessUpdateClosure | |||
553 | * GNUNET_NO if not. | 548 | * GNUNET_NO if not. |
554 | */ | 549 | */ |
555 | static int | 550 | static int |
556 | process_update_node (void *cls, | 551 | process_update_node (void *cls, const struct GNUNET_HashCode *key, void *value) |
557 | const struct GNUNET_HashCode *key, | ||
558 | void *value) | ||
559 | { | 552 | { |
560 | struct ProcessUpdateClosure *pc = cls; | 553 | struct ProcessUpdateClosure *pc = cls; |
561 | struct NamespaceUpdateNode *nsn = value; | 554 | struct NamespaceUpdateNode *nsn = value; |
562 | 555 | ||
563 | pc->ip (pc->ip_cls, | 556 | pc->ip (pc->ip_cls, nsn->id, nsn->uri, nsn->md, nsn->update); |
564 | nsn->id, | ||
565 | nsn->uri, | ||
566 | nsn->md, | ||
567 | nsn->update); | ||
568 | return GNUNET_YES; | 557 | return GNUNET_YES; |
569 | } | 558 | } |
570 | 559 | ||
@@ -622,9 +611,7 @@ struct FindTreeClosure | |||
622 | * GNUNET_NO if not. | 611 | * GNUNET_NO if not. |
623 | */ | 612 | */ |
624 | static int | 613 | static int |
625 | find_trees (void *cls, | 614 | find_trees (void *cls, const struct GNUNET_HashCode *key, void *value) |
626 | const struct GNUNET_HashCode *key, | ||
627 | void *value) | ||
628 | { | 615 | { |
629 | struct FindTreeClosure *fc = cls; | 616 | struct FindTreeClosure *fc = cls; |
630 | struct NamespaceUpdateNode *nsn = value; | 617 | struct NamespaceUpdateNode *nsn = value; |
@@ -633,26 +620,28 @@ find_trees (void *cls, | |||
633 | if (nsn->nug == fc->nug) | 620 | if (nsn->nug == fc->nug) |
634 | { | 621 | { |
635 | if (UINT_MAX == nsn->tree_id) | 622 | if (UINT_MAX == nsn->tree_id) |
636 | return GNUNET_YES; /* circular */ | 623 | return GNUNET_YES; /* circular */ |
637 | GNUNET_assert (nsn->tree_id < fc->tree_array_size); | 624 | GNUNET_assert (nsn->tree_id < fc->tree_array_size); |
638 | if (fc->tree_array[nsn->tree_id] != nsn) | 625 | if (fc->tree_array[nsn->tree_id] != nsn) |
639 | return GNUNET_YES; /* part of "another" (directed) TREE, | 626 | return GNUNET_YES; /* part of "another" (directed) TREE, |
640 | * and not root of it, end trace */ | 627 | * and not root of it, end trace */ |
641 | if (nsn->tree_id == fc->id) | 628 | if (nsn->tree_id == fc->id) |
642 | return GNUNET_YES; /* that's our own root (can this be?) */ | 629 | return GNUNET_YES; /* that's our own root (can this be?) */ |
643 | /* merge existing TREE, we have a root for both */ | 630 | /* merge existing TREE, we have a root for both */ |
644 | fc->tree_array[nsn->tree_id] = NULL; | 631 | fc->tree_array[nsn->tree_id] = NULL; |
645 | if (UINT_MAX == fc->id) | 632 | if (UINT_MAX == fc->id) |
646 | fc->id = nsn->tree_id; /* take over ID */ | 633 | fc->id = nsn->tree_id; /* take over ID */ |
647 | } | 634 | } |
648 | else | 635 | else |
649 | { | 636 | { |
650 | nsn->nug = fc->nug; | 637 | nsn->nug = fc->nug; |
651 | nsn->tree_id = UINT_MAX; /* mark as undef */ | 638 | nsn->tree_id = UINT_MAX; /* mark as undef */ |
652 | /* trace */ | 639 | /* trace */ |
653 | GNUNET_CRYPTO_hash (nsn->update, strlen (nsn->update), &hc); | 640 | GNUNET_CRYPTO_hash (nsn->update, strlen (nsn->update), &hc); |
654 | GNUNET_CONTAINER_multihashmap_get_multiple (fc->uig->update_map, &hc, | 641 | GNUNET_CONTAINER_multihashmap_get_multiple (fc->uig->update_map, |
655 | &find_trees, fc); | 642 | &hc, |
643 | &find_trees, | ||
644 | fc); | ||
656 | } | 645 | } |
657 | return GNUNET_YES; | 646 | return GNUNET_YES; |
658 | } | 647 | } |
@@ -682,11 +671,12 @@ find_trees (void *cls, | |||
682 | * @param ip_cls closure for ip | 671 | * @param ip_cls closure for ip |
683 | */ | 672 | */ |
684 | void | 673 | void |
685 | GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Handle *h, | 674 | GNUNET_FS_namespace_list_updateable ( |
686 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns, | 675 | struct GNUNET_FS_Handle *h, |
687 | const char *next_id, | 676 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns, |
688 | GNUNET_FS_IdentifierProcessor ip, | 677 | const char *next_id, |
689 | void *ip_cls) | 678 | GNUNET_FS_IdentifierProcessor ip, |
679 | void *ip_cls) | ||
690 | { | 680 | { |
691 | unsigned int i; | 681 | unsigned int i; |
692 | unsigned int nug; | 682 | unsigned int nug; |
@@ -700,29 +690,33 @@ GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Handle *h, | |||
700 | if (NULL == uig->update_nodes) | 690 | if (NULL == uig->update_nodes) |
701 | { | 691 | { |
702 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 692 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
703 | "No updateable nodes found for ID `%s'\n", next_id); | 693 | "No updateable nodes found for ID `%s'\n", |
694 | next_id); | ||
704 | free_update_information_graph (uig); | 695 | free_update_information_graph (uig); |
705 | return; /* no nodes */ | 696 | return; /* no nodes */ |
706 | } | 697 | } |
707 | uig->update_map = | 698 | uig->update_map = |
708 | GNUNET_CONTAINER_multihashmap_create (2 + | 699 | GNUNET_CONTAINER_multihashmap_create (2 + 3 * uig->update_node_count / 4, |
709 | 3 * uig->update_node_count / | 700 | GNUNET_NO); |
710 | 4, | ||
711 | GNUNET_NO); | ||
712 | for (i = 0; i < uig->update_node_count; i++) | 701 | for (i = 0; i < uig->update_node_count; i++) |
713 | { | 702 | { |
714 | nsn = uig->update_nodes[i]; | 703 | nsn = uig->update_nodes[i]; |
715 | GNUNET_CRYPTO_hash (nsn->id, strlen (nsn->id), &hc); | 704 | GNUNET_CRYPTO_hash (nsn->id, strlen (nsn->id), &hc); |
716 | GNUNET_CONTAINER_multihashmap_put (uig->update_map, &hc, nsn, | 705 | GNUNET_CONTAINER_multihashmap_put ( |
717 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 706 | uig->update_map, |
707 | &hc, | ||
708 | nsn, | ||
709 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | ||
718 | } | 710 | } |
719 | if (NULL != next_id) | 711 | if (NULL != next_id) |
720 | { | 712 | { |
721 | GNUNET_CRYPTO_hash (next_id, strlen (next_id), &hc); | 713 | GNUNET_CRYPTO_hash (next_id, strlen (next_id), &hc); |
722 | pc.ip = ip; | 714 | pc.ip = ip; |
723 | pc.ip_cls = ip_cls; | 715 | pc.ip_cls = ip_cls; |
724 | GNUNET_CONTAINER_multihashmap_get_multiple (uig->update_map, &hc, | 716 | GNUNET_CONTAINER_multihashmap_get_multiple (uig->update_map, |
725 | &process_update_node, &pc); | 717 | &hc, |
718 | &process_update_node, | ||
719 | &pc); | ||
726 | free_update_information_graph (uig); | 720 | free_update_information_graph (uig); |
727 | return; | 721 | return; |
728 | } | 722 | } |
@@ -738,9 +732,11 @@ GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Handle *h, | |||
738 | nsn = uig->update_nodes[i]; | 732 | nsn = uig->update_nodes[i]; |
739 | if (nsn->nug == nug) | 733 | if (nsn->nug == nug) |
740 | { | 734 | { |
741 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "TREE of node `%s' is %u\n", nsn->id, | 735 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
736 | "TREE of node `%s' is %u\n", | ||
737 | nsn->id, | ||
742 | nsn->nug); | 738 | nsn->nug); |
743 | continue; /* already placed in TREE */ | 739 | continue; /* already placed in TREE */ |
744 | } | 740 | } |
745 | GNUNET_CRYPTO_hash (nsn->update, strlen (nsn->update), &hc); | 741 | GNUNET_CRYPTO_hash (nsn->update, strlen (nsn->update), &hc); |
746 | nsn->nug = nug; | 742 | nsn->nug = nug; |
@@ -748,8 +744,10 @@ GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Handle *h, | |||
748 | fc.id = UINT_MAX; | 744 | fc.id = UINT_MAX; |
749 | fc.nug = nug; | 745 | fc.nug = nug; |
750 | fc.uig = uig; | 746 | fc.uig = uig; |
751 | GNUNET_CONTAINER_multihashmap_get_multiple (uig->update_map, &hc, | 747 | GNUNET_CONTAINER_multihashmap_get_multiple (uig->update_map, |
752 | &find_trees, &fc); | 748 | &hc, |
749 | &find_trees, | ||
750 | &fc); | ||
753 | if (UINT_MAX == fc.id) | 751 | if (UINT_MAX == fc.id) |
754 | { | 752 | { |
755 | /* start new TREE */ | 753 | /* start new TREE */ |
@@ -768,15 +766,18 @@ GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Handle *h, | |||
768 | nsn->tree_id = fc.id; | 766 | nsn->tree_id = fc.id; |
769 | } | 767 | } |
770 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 768 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
771 | "Starting new TREE %u with node `%s'\n", nsn->tree_id, | 769 | "Starting new TREE %u with node `%s'\n", |
770 | nsn->tree_id, | ||
772 | nsn->id); | 771 | nsn->id); |
773 | /* put all nodes with same identifier into this TREE */ | 772 | /* put all nodes with same identifier into this TREE */ |
774 | GNUNET_CRYPTO_hash (nsn->id, strlen (nsn->id), &hc); | 773 | GNUNET_CRYPTO_hash (nsn->id, strlen (nsn->id), &hc); |
775 | fc.id = nsn->tree_id; | 774 | fc.id = nsn->tree_id; |
776 | fc.nug = nug; | 775 | fc.nug = nug; |
777 | fc.uig = uig; | 776 | fc.uig = uig; |
778 | GNUNET_CONTAINER_multihashmap_get_multiple (uig->update_map, &hc, | 777 | GNUNET_CONTAINER_multihashmap_get_multiple (uig->update_map, |
779 | &find_trees, &fc); | 778 | &hc, |
779 | &find_trees, | ||
780 | &fc); | ||
780 | } | 781 | } |
781 | else | 782 | else |
782 | { | 783 | { |
@@ -785,7 +786,8 @@ GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Handle *h, | |||
785 | nsn->tree_id = fc.id; | 786 | nsn->tree_id = fc.id; |
786 | } | 787 | } |
787 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 788 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
788 | "TREE of node `%s' is %u\n", nsn->id, | 789 | "TREE of node `%s' is %u\n", |
790 | nsn->id, | ||
789 | fc.id); | 791 | fc.id); |
790 | } | 792 | } |
791 | for (i = 0; i < fc.tree_array_size; i++) | 793 | for (i = 0; i < fc.tree_array_size; i++) |
@@ -793,7 +795,9 @@ GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Handle *h, | |||
793 | nsn = fc.tree_array[i]; | 795 | nsn = fc.tree_array[i]; |
794 | if (NULL != nsn) | 796 | if (NULL != nsn) |
795 | { | 797 | { |
796 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Root of TREE %u is node `%s'\n", i, | 798 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
799 | "Root of TREE %u is node `%s'\n", | ||
800 | i, | ||
797 | nsn->id); | 801 | nsn->id); |
798 | ip (ip_cls, nsn->id, nsn->uri, nsn->md, nsn->update); | 802 | ip (ip_cls, nsn->id, nsn->uri, nsn->md, nsn->update); |
799 | } | 803 | } |