X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Ffs%2Fgnunet-publish.c;h=a1b26dbd5845da11eae06fee745c23cdd009a762;hb=1f09f4f7716db5939ec1c9a278b5661616dd72d6;hp=406433a71295b56b12e12af7d6e347710aa0c6e8;hpb=34228a39153d5ba620f3e8dde666475043af194b;p=oweals%2Fgnunet.git diff --git a/src/fs/gnunet-publish.c b/src/fs/gnunet-publish.c index 406433a71..a1b26dbd5 100644 --- a/src/fs/gnunet-publish.c +++ b/src/fs/gnunet-publish.c @@ -95,6 +95,29 @@ do_stop_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) } +/** + * Stop the directory scanner (we had an error). + * + * @param cls closure + * @param tc scheduler context + */ +static void +stop_scanner_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +{ + kill_task = GNUNET_SCHEDULER_NO_TASK; + GNUNET_FS_directory_scan_abort (ds); + ds = NULL; + if (namespace != NULL) + { + GNUNET_FS_namespace_delete (namespace, GNUNET_NO); + namespace = NULL; + } + GNUNET_FS_stop (ctx); + ctx = NULL; + ret = 1; +} + + /** * Called by FS client to give information about the progress of an * operation. @@ -268,6 +291,12 @@ publish_inspector (void *cls, struct GNUNET_FS_FileInformation *fi, } if (!do_disable_creation_time) GNUNET_CONTAINER_meta_data_add_publication_date (m); + if ( (disable_extractor) && + (NULL != *uri) ) + { + GNUNET_FS_uri_destroy (*uri); + *uri = NULL; + } if (extract_only) { fn = GNUNET_CONTAINER_meta_data_get_by_type (m, @@ -333,7 +362,7 @@ uri_ksk_continuation (void *cls, const struct GNUNET_FS_Uri *ksk_uri, { GNUNET_FS_publish_sks (ctx, ns, this_id, next_id, meta, uri, &bo, GNUNET_FS_PUBLISH_OPTION_NONE, - uri_sks_continuation, NULL); + &uri_sks_continuation, NULL); GNUNET_assert (GNUNET_OK == GNUNET_FS_namespace_delete (ns, GNUNET_NO)); return; } @@ -355,7 +384,7 @@ get_file_information (struct GNUNET_FS_ShareTreeItem *item) struct GNUNET_FS_FileInformation *fic; struct GNUNET_FS_ShareTreeItem *child; - if (item->is_directory) + if (item->is_directory == GNUNET_YES) { GNUNET_CONTAINER_meta_data_delete (item->meta, EXTRACTOR_METATYPE_MIMETYPE, NULL, 0); @@ -458,7 +487,7 @@ directory_scan_cb (void *cls, case GNUNET_FS_DIRSCANNER_FILE_START: if (verbose > 1) { - if (is_directory) + if (is_directory == GNUNET_YES) FPRINTF (stdout, _("Scanning directory `%s'.\n"), filename); else FPRINTF (stdout, _("Scanning file `%s'.\n"), filename); @@ -487,17 +516,12 @@ directory_scan_cb (void *cls, break; case GNUNET_FS_DIRSCANNER_INTERNAL_ERROR: FPRINTF (stdout, "%s", _("Internal error scanning directory.\n")); - GNUNET_FS_directory_scan_abort (ds); - ds = NULL; - if (namespace != NULL) - GNUNET_FS_namespace_delete (namespace, GNUNET_NO); - GNUNET_FS_stop (ctx); if (kill_task != GNUNET_SCHEDULER_NO_TASK) { GNUNET_SCHEDULER_cancel (kill_task); kill_task = GNUNET_SCHEDULER_NO_TASK; } - ret = 1; + kill_task = GNUNET_SCHEDULER_add_now (&stop_scanner_task, NULL); break; default: GNUNET_assert (0);