diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-09-15 18:23:27 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-09-15 18:23:27 +0000 |
commit | 8b20ea06fdb75740cead194d5c6826b4233ec500 (patch) | |
tree | b96b67ef0785a2bf9f1db49cee82e8cc5da4843e /src/fs | |
parent | 34f5392dc97d411d437c963af3a6a8ade2529306 (diff) | |
download | gnunet-8b20ea06fdb75740cead194d5c6826b4233ec500.tar.gz gnunet-8b20ea06fdb75740cead194d5c6826b4233ec500.zip |
-doxygen fixes, and fixing publish URI serization for proper resume
Diffstat (limited to 'src/fs')
-rw-r--r-- | src/fs/fs_api.c | 11 | ||||
-rw-r--r-- | src/fs/fs_download.c | 4 | ||||
-rw-r--r-- | src/fs/fs_file_information.c | 2 | ||||
-rw-r--r-- | src/fs/fs_publish.c | 77 | ||||
-rw-r--r-- | src/fs/fs_tree.c | 26 | ||||
-rw-r--r-- | src/fs/fs_tree.h | 18 | ||||
-rw-r--r-- | src/fs/fs_unindex.c | 9 |
7 files changed, 90 insertions, 57 deletions
diff --git a/src/fs/fs_api.c b/src/fs/fs_api.c index 1efda5a82..c2e2ada3e 100644 --- a/src/fs/fs_api.c +++ b/src/fs/fs_api.c | |||
@@ -1044,7 +1044,8 @@ cleanup: | |||
1044 | * @return NULL on error | 1044 | * @return NULL on error |
1045 | */ | 1045 | */ |
1046 | static struct GNUNET_FS_FileInformation * | 1046 | static struct GNUNET_FS_FileInformation * |
1047 | deserialize_file_information (struct GNUNET_FS_Handle *h, const char *filename) | 1047 | deserialize_file_information (struct GNUNET_FS_Handle *h, |
1048 | const char *filename) | ||
1048 | { | 1049 | { |
1049 | struct GNUNET_FS_FileInformation *ret; | 1050 | struct GNUNET_FS_FileInformation *ret; |
1050 | struct GNUNET_BIO_ReadHandle *rh; | 1051 | struct GNUNET_BIO_ReadHandle *rh; |
@@ -1726,9 +1727,9 @@ cleanup: | |||
1726 | /** | 1727 | /** |
1727 | * Serialize a download request. | 1728 | * Serialize a download request. |
1728 | * | 1729 | * |
1729 | * @param wh the 'struct GNUNET_BIO_WriteHandle*' | 1730 | * @param wh the `struct GNUNET_BIO_WriteHandle*` |
1730 | * @param dr the 'struct DownloadRequest' | 1731 | * @param dr the the request to write to disk |
1731 | * @return GNUNET_YES on success, GNUNET_NO on error | 1732 | * @return #GNUNET_YES on success, #GNUNET_NO on error |
1732 | */ | 1733 | */ |
1733 | static int | 1734 | static int |
1734 | write_download_request (struct GNUNET_BIO_WriteHandle *wh, | 1735 | write_download_request (struct GNUNET_BIO_WriteHandle *wh, |
@@ -1756,7 +1757,7 @@ write_download_request (struct GNUNET_BIO_WriteHandle *wh, | |||
1756 | * Read a download request tree. | 1757 | * Read a download request tree. |
1757 | * | 1758 | * |
1758 | * @param rh mesh to read from | 1759 | * @param rh mesh to read from |
1759 | * @return value the 'struct DownloadRequest', NULL on error | 1760 | * @return value the download request read from disk, NULL on error |
1760 | */ | 1761 | */ |
1761 | static struct DownloadRequest * | 1762 | static struct DownloadRequest * |
1762 | read_download_request (struct GNUNET_BIO_ReadHandle *rh) | 1763 | read_download_request (struct GNUNET_BIO_ReadHandle *rh) |
diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c index 1175fcd05..2b67dc31e 100644 --- a/src/fs/fs_download.c +++ b/src/fs/fs_download.c | |||
@@ -2021,7 +2021,7 @@ GNUNET_FS_download_signal_suspend_ (void *cls) | |||
2021 | GNUNET_FS_download_make_status_ (&pi, dc); | 2021 | GNUNET_FS_download_make_status_ (&pi, dc); |
2022 | if (NULL != dc->te) | 2022 | if (NULL != dc->te) |
2023 | { | 2023 | { |
2024 | GNUNET_FS_tree_encoder_finish (dc->te, NULL, NULL); | 2024 | GNUNET_FS_tree_encoder_finish (dc->te, NULL); |
2025 | dc->te = NULL; | 2025 | dc->te = NULL; |
2026 | } | 2026 | } |
2027 | if (NULL != dc->rfh) | 2027 | if (NULL != dc->rfh) |
@@ -2310,7 +2310,7 @@ GNUNET_FS_download_stop (struct GNUNET_FS_DownloadContext *dc, int do_delete) | |||
2310 | } | 2310 | } |
2311 | if (NULL != dc->te) | 2311 | if (NULL != dc->te) |
2312 | { | 2312 | { |
2313 | GNUNET_FS_tree_encoder_finish (dc->te, NULL, NULL); | 2313 | GNUNET_FS_tree_encoder_finish (dc->te, NULL); |
2314 | dc->te = NULL; | 2314 | dc->te = NULL; |
2315 | } | 2315 | } |
2316 | have_children = (NULL != dc->child_head) ? GNUNET_YES : GNUNET_NO; | 2316 | have_children = (NULL != dc->child_head) ? GNUNET_YES : GNUNET_NO; |
diff --git a/src/fs/fs_file_information.c b/src/fs/fs_file_information.c index b1ec1ed5d..ad3dda05b 100644 --- a/src/fs/fs_file_information.c +++ b/src/fs/fs_file_information.c | |||
@@ -451,7 +451,7 @@ GNUNET_FS_file_information_destroy (struct GNUNET_FS_FileInformation *fi, | |||
451 | GNUNET_free_non_null (fi->serialization); | 451 | GNUNET_free_non_null (fi->serialization); |
452 | if (NULL != fi->te) | 452 | if (NULL != fi->te) |
453 | { | 453 | { |
454 | GNUNET_FS_tree_encoder_finish (fi->te, NULL, NULL); | 454 | GNUNET_FS_tree_encoder_finish (fi->te, NULL); |
455 | fi->te = NULL; | 455 | fi->te = NULL; |
456 | } | 456 | } |
457 | GNUNET_free (fi); | 457 | GNUNET_free (fi); |
diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c index 73af99ce9..224f0c35e 100644 --- a/src/fs/fs_publish.c +++ b/src/fs/fs_publish.c | |||
@@ -213,7 +213,8 @@ finish_release_reserve (void *cls, int success, | |||
213 | struct GNUNET_FS_PublishContext *pc = cls; | 213 | struct GNUNET_FS_PublishContext *pc = cls; |
214 | 214 | ||
215 | pc->qre = NULL; | 215 | pc->qre = NULL; |
216 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Releasing reserve done!\n"); | 216 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
217 | "Releasing reserve done!\n"); | ||
217 | signal_publish_completion (pc->fi, pc); | 218 | signal_publish_completion (pc->fi, pc); |
218 | pc->all_done = GNUNET_YES; | 219 | pc->all_done = GNUNET_YES; |
219 | GNUNET_FS_publish_sync_ (pc); | 220 | GNUNET_FS_publish_sync_ (pc); |
@@ -299,7 +300,8 @@ publish_kblocks_cont (void *cls, const struct GNUNET_FS_Uri *uri, | |||
299 | pc->ksk_pc = NULL; | 300 | pc->ksk_pc = NULL; |
300 | if (NULL != emsg) | 301 | if (NULL != emsg) |
301 | { | 302 | { |
302 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Error uploading KSK blocks: %s\n", | 303 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
304 | "Error uploading KSK blocks: %s\n", | ||
303 | emsg); | 305 | emsg); |
304 | signal_publish_error (p, pc, emsg); | 306 | signal_publish_error (p, pc, emsg); |
305 | GNUNET_FS_file_information_sync_ (p); | 307 | GNUNET_FS_file_information_sync_ (p); |
@@ -396,15 +398,21 @@ encode_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
396 | char *emsg; | 398 | char *emsg; |
397 | uint64_t flen; | 399 | uint64_t flen; |
398 | 400 | ||
399 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Finished with tree encoder\n"); | 401 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
402 | "Finished with tree encoder\n"); | ||
400 | p = pc->fi_pos; | 403 | p = pc->fi_pos; |
404 | p->chk_uri = GNUNET_FS_tree_encoder_get_uri (p->te); | ||
401 | GNUNET_FS_file_information_sync_ (p); | 405 | GNUNET_FS_file_information_sync_ (p); |
402 | GNUNET_FS_tree_encoder_finish (p->te, &p->chk_uri, &emsg); | 406 | GNUNET_FS_tree_encoder_finish (p->te, &emsg); |
403 | p->te = NULL; | 407 | p->te = NULL; |
404 | if (NULL != emsg) | 408 | if (NULL != emsg) |
405 | { | 409 | { |
406 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Error during tree walk: %s\n", emsg); | 410 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
407 | GNUNET_asprintf (&p->emsg, _("Publishing failed: %s"), emsg); | 411 | "Error during tree walk: %s\n", |
412 | emsg); | ||
413 | GNUNET_asprintf (&p->emsg, | ||
414 | _("Publishing failed: %s"), | ||
415 | emsg); | ||
408 | GNUNET_free (emsg); | 416 | GNUNET_free (emsg); |
409 | pi.status = GNUNET_FS_STATUS_PUBLISH_ERROR; | 417 | pi.status = GNUNET_FS_STATUS_PUBLISH_ERROR; |
410 | pi.value.publish.eta = GNUNET_TIME_UNIT_FOREVER_REL; | 418 | pi.value.publish.eta = GNUNET_TIME_UNIT_FOREVER_REL; |
@@ -434,8 +442,8 @@ encode_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
434 | /** | 442 | /** |
435 | * Function called asking for the current (encoded) | 443 | * Function called asking for the current (encoded) |
436 | * block to be processed. After processing the | 444 | * block to be processed. After processing the |
437 | * client should either call "GNUNET_FS_tree_encode_next" | 445 | * client should either call #GNUNET_FS_tree_encode_next |
438 | * or (on error) "GNUNET_FS_tree_encode_finish". | 446 | * or (on error) #GNUNET_FS_tree_encode_finish. |
439 | * | 447 | * |
440 | * @param cls closure | 448 | * @param cls closure |
441 | * @param chk content hash key for the block | 449 | * @param chk content hash key for the block |
@@ -465,8 +473,9 @@ block_proc (void *cls, const struct ContentHashKey *chk, uint64_t offset, | |||
465 | return; | 473 | return; |
466 | } | 474 | } |
467 | 475 | ||
468 | if ((p->is_directory != GNUNET_YES) && (GNUNET_YES == p->data.file.do_index) && | 476 | if ( (GNUNET_YES != p->is_directory) && |
469 | (type == GNUNET_BLOCK_TYPE_FS_DBLOCK)) | 477 | (GNUNET_YES == p->data.file.do_index) && |
478 | (GNUNET_BLOCK_TYPE_FS_DBLOCK == type) ) | ||
470 | { | 479 | { |
471 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 480 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
472 | "Indexing block `%s' for offset %llu with index size %u\n", | 481 | "Indexing block `%s' for offset %llu with index size %u\n", |
@@ -546,17 +555,17 @@ publish_content (struct GNUNET_FS_PublishContext *pc) | |||
546 | uint64_t size; | 555 | uint64_t size; |
547 | 556 | ||
548 | p = pc->fi_pos; | 557 | p = pc->fi_pos; |
549 | GNUNET_assert (p != NULL); | 558 | GNUNET_assert (NULL != p); |
550 | if (NULL == p->te) | 559 | if (NULL == p->te) |
551 | { | 560 | { |
552 | if (p->is_directory == GNUNET_YES) | 561 | if (GNUNET_YES == p->is_directory) |
553 | { | 562 | { |
554 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating directory\n"); | 563 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating directory\n"); |
555 | db = GNUNET_FS_directory_builder_create (p->meta); | 564 | db = GNUNET_FS_directory_builder_create (p->meta); |
556 | dirpos = p->data.dir.entries; | 565 | dirpos = p->data.dir.entries; |
557 | while (NULL != dirpos) | 566 | while (NULL != dirpos) |
558 | { | 567 | { |
559 | if (dirpos->is_directory == GNUNET_YES) | 568 | if (GNUNET_YES == dirpos->is_directory) |
560 | { | 569 | { |
561 | raw_data = dirpos->data.dir.dir_data; | 570 | raw_data = dirpos->data.dir.dir_data; |
562 | dirpos->data.dir.dir_data = NULL; | 571 | dirpos->data.dir.dir_data = NULL; |
@@ -593,15 +602,17 @@ publish_content (struct GNUNET_FS_PublishContext *pc) | |||
593 | &p->data.dir.dir_data); | 602 | &p->data.dir.dir_data); |
594 | GNUNET_FS_file_information_sync_ (p); | 603 | GNUNET_FS_file_information_sync_ (p); |
595 | } | 604 | } |
596 | size = (p->is_directory == GNUNET_YES) ? p->data.dir.dir_size : p->data.file.file_size; | 605 | size = (GNUNET_YES == p->is_directory) ? p->data.dir.dir_size : p->data.file.file_size; |
597 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating tree encoder\n"); | 606 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
607 | "Creating tree encoder\n"); | ||
598 | p->te = | 608 | p->te = |
599 | GNUNET_FS_tree_encoder_create (pc->h, size, pc, &block_reader, | 609 | GNUNET_FS_tree_encoder_create (pc->h, size, pc, &block_reader, |
600 | &block_proc, &progress_proc, | 610 | &block_proc, &progress_proc, |
601 | &encode_cont); | 611 | &encode_cont); |
602 | 612 | ||
603 | } | 613 | } |
604 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Processing next block from tree\n"); | 614 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
615 | "Processing next block from tree\n"); | ||
605 | GNUNET_FS_tree_encoder_next (p->te); | 616 | GNUNET_FS_tree_encoder_next (p->te); |
606 | } | 617 | } |
607 | 618 | ||
@@ -625,11 +636,10 @@ process_index_start_response (void *cls, | |||
625 | GNUNET_CLIENT_disconnect (pc->client); | 636 | GNUNET_CLIENT_disconnect (pc->client); |
626 | pc->client = NULL; | 637 | pc->client = NULL; |
627 | p = pc->fi_pos; | 638 | p = pc->fi_pos; |
628 | if (msg == NULL) | 639 | if (NULL == msg) |
629 | { | 640 | { |
630 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 641 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
631 | _ | 642 | _("Can not index file `%s': %s. Will try to insert instead.\n"), |
632 | ("Can not index file `%s': %s. Will try to insert instead.\n"), | ||
633 | p->filename, | 643 | p->filename, |
634 | _("timeout on index-start request to `fs' service")); | 644 | _("timeout on index-start request to `fs' service")); |
635 | p->data.file.do_index = GNUNET_NO; | 645 | p->data.file.do_index = GNUNET_NO; |
@@ -685,9 +695,9 @@ hash_for_index_cb (void *cls, | |||
685 | if (NULL == res) | 695 | if (NULL == res) |
686 | { | 696 | { |
687 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 697 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
688 | _ | 698 | _("Can not index file `%s': %s. Will try to insert instead.\n"), |
689 | ("Can not index file `%s': %s. Will try to insert instead.\n"), | 699 | p->filename, |
690 | p->filename, _("failed to compute hash")); | 700 | _("failed to compute hash")); |
691 | p->data.file.do_index = GNUNET_NO; | 701 | p->data.file.do_index = GNUNET_NO; |
692 | GNUNET_FS_file_information_sync_ (p); | 702 | GNUNET_FS_file_information_sync_ (p); |
693 | publish_content (pc); | 703 | publish_content (pc); |
@@ -730,9 +740,9 @@ hash_for_index_cb (void *cls, | |||
730 | if (NULL == client) | 740 | if (NULL == client) |
731 | { | 741 | { |
732 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 742 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
733 | _ | 743 | _("Can not index file `%s': %s. Will try to insert instead.\n"), |
734 | ("Can not index file `%s': %s. Will try to insert instead.\n"), | 744 | p->filename, |
735 | p->filename, _("could not connect to `fs' service")); | 745 | _("could not connect to `fs' service")); |
736 | p->data.file.do_index = GNUNET_NO; | 746 | p->data.file.do_index = GNUNET_NO; |
737 | publish_content (pc); | 747 | publish_content (pc); |
738 | GNUNET_free (fn); | 748 | GNUNET_free (fn); |
@@ -854,10 +864,11 @@ GNUNET_FS_publish_main_ (void *cls, | |||
854 | p->bo.expiration_time); | 864 | p->bo.expiration_time); |
855 | GNUNET_FS_uri_destroy (p->chk_uri); | 865 | GNUNET_FS_uri_destroy (p->chk_uri); |
856 | p->chk_uri = loc; | 866 | p->chk_uri = loc; |
867 | GNUNET_FS_file_information_sync_ (p); | ||
857 | } | 868 | } |
858 | GNUNET_FS_publish_sync_ (pc); | 869 | GNUNET_FS_publish_sync_ (pc); |
859 | /* upload of "p" complete, publish KBlocks! */ | 870 | /* upload of "p" complete, publish KBlocks! */ |
860 | if (p->keywords != NULL) | 871 | if (NULL != p->keywords) |
861 | { | 872 | { |
862 | pc->ksk_pc = GNUNET_FS_publish_ksk (pc->h, p->keywords, p->meta, p->chk_uri, &p->bo, | 873 | pc->ksk_pc = GNUNET_FS_publish_ksk (pc->h, p->keywords, p->meta, p->chk_uri, &p->bo, |
863 | pc->options, &publish_kblocks_cont, pc); | 874 | pc->options, &publish_kblocks_cont, pc); |
@@ -868,7 +879,7 @@ GNUNET_FS_publish_main_ (void *cls, | |||
868 | } | 879 | } |
869 | return; | 880 | return; |
870 | } | 881 | } |
871 | if ((p->is_directory != GNUNET_YES) && (p->data.file.do_index)) | 882 | if ((GNUNET_YES != p->is_directory) && (p->data.file.do_index)) |
872 | { | 883 | { |
873 | if (NULL == p->filename) | 884 | if (NULL == p->filename) |
874 | { | 885 | { |
@@ -932,7 +943,8 @@ fip_signal_start (void *cls, | |||
932 | pc->skip_next_fi_callback = GNUNET_NO; | 943 | pc->skip_next_fi_callback = GNUNET_NO; |
933 | return GNUNET_OK; | 944 | return GNUNET_OK; |
934 | } | 945 | } |
935 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting publish operation\n"); | 946 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
947 | "Starting publish operation\n"); | ||
936 | if (*do_index) | 948 | if (*do_index) |
937 | { | 949 | { |
938 | /* space for on-demand blocks */ | 950 | /* space for on-demand blocks */ |
@@ -1001,10 +1013,11 @@ suspend_operation (struct GNUNET_FS_FileInformation *fi, | |||
1001 | GNUNET_FS_publish_sks_cancel (pc->sks_pc); | 1013 | GNUNET_FS_publish_sks_cancel (pc->sks_pc); |
1002 | pc->sks_pc = NULL; | 1014 | pc->sks_pc = NULL; |
1003 | } | 1015 | } |
1004 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Suspending publish operation\n"); | 1016 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1017 | "Suspending publish operation\n"); | ||
1005 | GNUNET_free_non_null (fi->serialization); | 1018 | GNUNET_free_non_null (fi->serialization); |
1006 | fi->serialization = NULL; | 1019 | fi->serialization = NULL; |
1007 | off = (fi->chk_uri == NULL) ? 0 : (fi->is_directory == GNUNET_YES) ? fi->data.dir.dir_size : fi->data.file.file_size; | 1020 | off = (NULL == fi->chk_uri) ? 0 : (GNUNET_YES == fi->is_directory) ? fi->data.dir.dir_size : fi->data.file.file_size; |
1008 | pi.status = GNUNET_FS_STATUS_PUBLISH_SUSPEND; | 1021 | pi.status = GNUNET_FS_STATUS_PUBLISH_SUSPEND; |
1009 | GNUNET_break (NULL == GNUNET_FS_publish_make_status_ (&pi, pc, fi, off)); | 1022 | GNUNET_break (NULL == GNUNET_FS_publish_make_status_ (&pi, pc, fi, off)); |
1010 | if (NULL != pc->qre) | 1023 | if (NULL != pc->qre) |
@@ -1025,7 +1038,7 @@ suspend_operation (struct GNUNET_FS_FileInformation *fi, | |||
1025 | * Signal the FS's progress function that we are suspending | 1038 | * Signal the FS's progress function that we are suspending |
1026 | * an upload. Performs the recursion. | 1039 | * an upload. Performs the recursion. |
1027 | * | 1040 | * |
1028 | * @param cls closure (of type "struct GNUNET_FS_PublishContext*") | 1041 | * @param cls closure (of type `struct GNUNET_FS_PublishContext *`) |
1029 | * @param fi the entry in the publish-structure | 1042 | * @param fi the entry in the publish-structure |
1030 | * @param length length of the file or directory | 1043 | * @param length length of the file or directory |
1031 | * @param meta metadata for the file or directory (can be modified) | 1044 | * @param meta metadata for the file or directory (can be modified) |
@@ -1068,7 +1081,7 @@ fip_signal_suspend (void *cls, | |||
1068 | * Create SUSPEND event for the given publish operation | 1081 | * Create SUSPEND event for the given publish operation |
1069 | * and then clean up our state (without stop signal). | 1082 | * and then clean up our state (without stop signal). |
1070 | * | 1083 | * |
1071 | * @param cls the 'struct GNUNET_FS_PublishContext' to signal for | 1084 | * @param cls the `struct GNUNET_FS_PublishContext` to signal for |
1072 | */ | 1085 | */ |
1073 | void | 1086 | void |
1074 | GNUNET_FS_publish_signal_suspend_ (void *cls) | 1087 | GNUNET_FS_publish_signal_suspend_ (void *cls) |
diff --git a/src/fs/fs_tree.c b/src/fs/fs_tree.c index 762989824..b9dd894f5 100644 --- a/src/fs/fs_tree.c +++ b/src/fs/fs_tree.c | |||
@@ -416,19 +416,33 @@ GNUNET_FS_tree_encoder_next (struct GNUNET_FS_TreeEncoder *te) | |||
416 | 416 | ||
417 | 417 | ||
418 | /** | 418 | /** |
419 | * Get the resulting URI from the encoding. | ||
420 | * | ||
421 | * @param te the tree encoder to clean up | ||
422 | * @return uri set to the resulting URI (if encoding finished), NULL otherwise | ||
423 | */ | ||
424 | struct GNUNET_FS_Uri * | ||
425 | GNUNET_FS_tree_encoder_get_uri (struct GNUNET_FS_TreeEncoder *te) | ||
426 | { | ||
427 | if (NULL != te->uri) | ||
428 | return GNUNET_FS_uri_dup (te->uri); | ||
429 | return NULL; | ||
430 | } | ||
431 | |||
432 | |||
433 | /** | ||
419 | * Clean up a tree encoder and return information | 434 | * Clean up a tree encoder and return information |
420 | * about the resulting URI or an error message. | 435 | * about possible errors. |
421 | * | 436 | * |
422 | * @param te the tree encoder to clean up | 437 | * @param te the tree encoder to clean up |
423 | * @param uri set to the resulting URI (if encoding finished) | ||
424 | * @param emsg set to an error message (if an error occured | 438 | * @param emsg set to an error message (if an error occured |
425 | * within the tree encoder; if this function is called | 439 | * within the tree encoder; if this function is called |
426 | * prior to completion and prior to an internal error, | 440 | * prior to completion and prior to an internal error, |
427 | * both "*uri" and "*emsg" will be set to NULL). | 441 | * both "*emsg" will be set to NULL). |
428 | */ | 442 | */ |
429 | void | 443 | void |
430 | GNUNET_FS_tree_encoder_finish (struct GNUNET_FS_TreeEncoder *te, | 444 | GNUNET_FS_tree_encoder_finish (struct GNUNET_FS_TreeEncoder *te, |
431 | struct GNUNET_FS_Uri **uri, char **emsg) | 445 | char **emsg) |
432 | { | 446 | { |
433 | if (NULL != te->reader) | 447 | if (NULL != te->reader) |
434 | { | 448 | { |
@@ -436,9 +450,7 @@ GNUNET_FS_tree_encoder_finish (struct GNUNET_FS_TreeEncoder *te, | |||
436 | te->reader = NULL; | 450 | te->reader = NULL; |
437 | } | 451 | } |
438 | GNUNET_assert (GNUNET_NO == te->in_next); | 452 | GNUNET_assert (GNUNET_NO == te->in_next); |
439 | if (uri != NULL) | 453 | if (NULL != te->uri) |
440 | *uri = te->uri; | ||
441 | else if (NULL != te->uri) | ||
442 | GNUNET_FS_uri_destroy (te->uri); | 454 | GNUNET_FS_uri_destroy (te->uri); |
443 | if (emsg != NULL) | 455 | if (emsg != NULL) |
444 | *emsg = te->emsg; | 456 | *emsg = te->emsg; |
diff --git a/src/fs/fs_tree.h b/src/fs/fs_tree.h index 5b1c2024f..cd25a6dd1 100644 --- a/src/fs/fs_tree.h +++ b/src/fs/fs_tree.h | |||
@@ -158,19 +158,28 @@ GNUNET_FS_tree_encoder_next (struct GNUNET_FS_TreeEncoder *te); | |||
158 | 158 | ||
159 | 159 | ||
160 | /** | 160 | /** |
161 | * Get the resulting URI from the encoding. | ||
162 | * | ||
163 | * @param te the tree encoder to clean up | ||
164 | * @return uri set to the resulting URI (if encoding finished), NULL otherwise | ||
165 | */ | ||
166 | struct GNUNET_FS_Uri * | ||
167 | GNUNET_FS_tree_encoder_get_uri (struct GNUNET_FS_TreeEncoder *te); | ||
168 | |||
169 | |||
170 | /** | ||
161 | * Clean up a tree encoder and return information | 171 | * Clean up a tree encoder and return information |
162 | * about the resulting URI or an error message. | 172 | * about possible errors. |
163 | * | 173 | * |
164 | * @param te the tree encoder to clean up | 174 | * @param te the tree encoder to clean up |
165 | * @param uri set to the resulting URI (if encoding finished) | ||
166 | * @param emsg set to an error message (if an error occured | 175 | * @param emsg set to an error message (if an error occured |
167 | * within the tree encoder; if this function is called | 176 | * within the tree encoder; if this function is called |
168 | * prior to completion and prior to an internal error, | 177 | * prior to completion and prior to an internal error, |
169 | * both "*uri" and "*emsg" will be set to NULL). | 178 | * both "*emsg" will be set to NULL). |
170 | */ | 179 | */ |
171 | void | 180 | void |
172 | GNUNET_FS_tree_encoder_finish (struct GNUNET_FS_TreeEncoder *te, | 181 | GNUNET_FS_tree_encoder_finish (struct GNUNET_FS_TreeEncoder *te, |
173 | struct GNUNET_FS_Uri **uri, char **emsg); | 182 | char **emsg); |
174 | 183 | ||
175 | 184 | ||
176 | #if 0 | 185 | #if 0 |
@@ -200,6 +209,7 @@ GNUNET_FS_tree_encoder_resume_get_data (const struct GNUNET_FS_TreeEncoder *te, | |||
200 | void | 209 | void |
201 | GNUNET_FS_tree_encoder_resume (struct GNUNET_FS_TreeEncoder *te, | 210 | GNUNET_FS_tree_encoder_resume (struct GNUNET_FS_TreeEncoder *te, |
202 | const void *data, size_t size); | 211 | const void *data, size_t size); |
212 | |||
203 | #endif | 213 | #endif |
204 | 214 | ||
205 | #endif | 215 | #endif |
diff --git a/src/fs/fs_unindex.c b/src/fs/fs_unindex.c index bb3accb82..ecf14112c 100644 --- a/src/fs/fs_unindex.c +++ b/src/fs/fs_unindex.c | |||
@@ -271,15 +271,12 @@ static void | |||
271 | unindex_finish (struct GNUNET_FS_UnindexContext *uc) | 271 | unindex_finish (struct GNUNET_FS_UnindexContext *uc) |
272 | { | 272 | { |
273 | char *emsg; | 273 | char *emsg; |
274 | struct GNUNET_FS_Uri *uri; | ||
275 | struct UnindexMessage req; | 274 | struct UnindexMessage req; |
276 | 275 | ||
277 | /* generate final progress message */ | 276 | /* generate final progress message */ |
278 | unindex_progress (uc, uc->file_size, NULL, 0, 0); | 277 | unindex_progress (uc, uc->file_size, NULL, 0, 0); |
279 | GNUNET_FS_tree_encoder_finish (uc->tc, &uri, &emsg); | 278 | GNUNET_FS_tree_encoder_finish (uc->tc, &emsg); |
280 | uc->tc = NULL; | 279 | uc->tc = NULL; |
281 | if (uri != NULL) | ||
282 | GNUNET_FS_uri_destroy (uri); | ||
283 | GNUNET_DISK_file_close (uc->fh); | 280 | GNUNET_DISK_file_close (uc->fh); |
284 | uc->fh = NULL; | 281 | uc->fh = NULL; |
285 | GNUNET_DATASTORE_disconnect (uc->dsh, GNUNET_NO); | 282 | GNUNET_DATASTORE_disconnect (uc->dsh, GNUNET_NO); |
@@ -730,7 +727,7 @@ GNUNET_FS_unindex_signal_suspend_ (void *cls) | |||
730 | } | 727 | } |
731 | if (NULL != uc->tc) | 728 | if (NULL != uc->tc) |
732 | { | 729 | { |
733 | GNUNET_FS_tree_encoder_finish (uc->tc, NULL, NULL); | 730 | GNUNET_FS_tree_encoder_finish (uc->tc, NULL); |
734 | uc->tc = NULL; | 731 | uc->tc = NULL; |
735 | } | 732 | } |
736 | if (uc->fh != NULL) | 733 | if (uc->fh != NULL) |
@@ -831,7 +828,7 @@ GNUNET_FS_unindex_stop (struct GNUNET_FS_UnindexContext *uc) | |||
831 | } | 828 | } |
832 | if (NULL != uc->tc) | 829 | if (NULL != uc->tc) |
833 | { | 830 | { |
834 | GNUNET_FS_tree_encoder_finish (uc->tc, NULL, NULL); | 831 | GNUNET_FS_tree_encoder_finish (uc->tc, NULL); |
835 | uc->tc = NULL; | 832 | uc->tc = NULL; |
836 | } | 833 | } |
837 | if (uc->fh != NULL) | 834 | if (uc->fh != NULL) |