From a1ad98480a419d9261528aa307a98a06942a4a83 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 18 Oct 2009 20:47:42 +0000 Subject: fixes --- src/fs/fs_tree.c | 26 +++++++++++++------------- src/fs/test_fs_download.c | 26 ++++++++++++++++++-------- 2 files changed, 31 insertions(+), 21 deletions(-) diff --git a/src/fs/fs_tree.c b/src/fs/fs_tree.c index b409080db..2108b4831 100644 --- a/src/fs/fs_tree.c +++ b/src/fs/fs_tree.c @@ -250,7 +250,6 @@ compute_chk_offset (unsigned int height, corresponds to */ for (i=0;icurrent_depth) + { + te->uri = GNUNET_malloc (sizeof(struct GNUNET_FS_Uri)); + te->uri->type = chk; + te->uri->data.chk.chk = te->chk_tree[0]; + te->uri->data.chk.file_length = GNUNET_htonll (te->size); + GNUNET_SCHEDULER_add_continuation (te->h->sched, + GNUNET_NO, + te->cont, + te->cls, + GNUNET_SCHEDULER_REASON_PREREQ_DONE); + return; + } if (NULL != te->proc) te->proc (te->cls, &mychk->query, @@ -343,18 +355,6 @@ void GNUNET_FS_tree_encoder_next (struct GNUNET_FS_TreeEncoder * te) else te->current_depth = te->chk_tree_depth; } - if (0 == te->current_depth) - { - te->uri = GNUNET_malloc (sizeof(struct GNUNET_FS_Uri)); - te->uri->type = chk; - te->uri->data.chk.chk = te->chk_tree[0]; - te->uri->data.chk.file_length = GNUNET_htonll (te->size); - GNUNET_SCHEDULER_add_continuation (te->h->sched, - GNUNET_NO, - te->cont, - te->cls, - GNUNET_SCHEDULER_REASON_PREREQ_DONE); - } } diff --git a/src/fs/test_fs_download.c b/src/fs/test_fs_download.c index ffb90d678..730720d40 100644 --- a/src/fs/test_fs_download.c +++ b/src/fs/test_fs_download.c @@ -96,17 +96,22 @@ progress_cb (void *cls, { case GNUNET_FS_STATUS_PUBLISH_PROGRESS: #if DEBUG_VERBOSE - printf ("Publish is progressing (%llu/%llu)...\n", + printf ("Publish is progressing (%llu/%llu at level %u off %llu)...\n", (unsigned long long) event->value.publish.completed, - (unsigned long long) event->value.publish.size); + (unsigned long long) event->value.publish.size, + event->value.publish.specifics.progress.depth, + (unsigned long long) event->value.publish.specifics.progress.offset); #endif break; case GNUNET_FS_STATUS_PUBLISH_COMPLETED: #if DEBUG_VERBOSE printf ("Publish complete.\n"); #endif - GNUNET_FS_publish_stop (publish); - publish = NULL; + GNUNET_SCHEDULER_add_continuation (sched, + GNUNET_NO, + &abort_publish_task, + NULL, + GNUNET_SCHEDULER_REASON_PREREQ_DONE); fn = GNUNET_DISK_mktemp ("gnunet-download-test-dstXXXXXX"); download = GNUNET_FS_download_start (fs, event->value.publish.specifics.completed.chk_uri, @@ -123,14 +128,19 @@ progress_cb (void *cls, #if DEBUG_VERBOSE printf ("Download complete.\n"); #endif - GNUNET_FS_download_stop (download, GNUNET_YES); - download = NULL; + GNUNET_SCHEDULER_add_continuation (sched, + GNUNET_NO, + &abort_download_task, + NULL, + GNUNET_SCHEDULER_REASON_PREREQ_DONE); break; case GNUNET_FS_STATUS_DOWNLOAD_PROGRESS: #if DEBUG_VERBOSE - printf ("Download is progressing (%llu/%llu)...\n", + printf ("Download is progressing (%llu/%llu at level %u off %llu)...\n", (unsigned long long) event->value.download.completed, - (unsigned long long) event->value.download.size); + (unsigned long long) event->value.download.size, + event->value.download.specifics.progress.depth, + (unsigned long long) event->value.download.specifics.progress.offset); #endif break; case GNUNET_FS_STATUS_PUBLISH_ERROR: -- cgit v1.2.3