diff options
-rw-r--r-- | src/fs/fs_tree.c | 26 | ||||
-rw-r--r-- | 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, | |||
250 | corresponds to */ | 250 | corresponds to */ |
251 | for (i=0;i<height;i++) | 251 | for (i=0;i<height;i++) |
252 | bds *= CHK_PER_INODE; | 252 | bds *= CHK_PER_INODE; |
253 | GNUNET_assert (0 == (offset % bds)); | ||
254 | ret = offset / bds; | 253 | ret = offset / bds; |
255 | return ret % CHK_PER_INODE; | 254 | return ret % CHK_PER_INODE; |
256 | } | 255 | } |
@@ -312,6 +311,19 @@ void GNUNET_FS_tree_encoder_next (struct GNUNET_FS_TreeEncoder * te) | |||
312 | &sk, | 311 | &sk, |
313 | &iv, | 312 | &iv, |
314 | enc); | 313 | enc); |
314 | if (0 == te->current_depth) | ||
315 | { | ||
316 | te->uri = GNUNET_malloc (sizeof(struct GNUNET_FS_Uri)); | ||
317 | te->uri->type = chk; | ||
318 | te->uri->data.chk.chk = te->chk_tree[0]; | ||
319 | te->uri->data.chk.file_length = GNUNET_htonll (te->size); | ||
320 | GNUNET_SCHEDULER_add_continuation (te->h->sched, | ||
321 | GNUNET_NO, | ||
322 | te->cont, | ||
323 | te->cls, | ||
324 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | ||
325 | return; | ||
326 | } | ||
315 | if (NULL != te->proc) | 327 | if (NULL != te->proc) |
316 | te->proc (te->cls, | 328 | te->proc (te->cls, |
317 | &mychk->query, | 329 | &mychk->query, |
@@ -343,18 +355,6 @@ void GNUNET_FS_tree_encoder_next (struct GNUNET_FS_TreeEncoder * te) | |||
343 | else | 355 | else |
344 | te->current_depth = te->chk_tree_depth; | 356 | te->current_depth = te->chk_tree_depth; |
345 | } | 357 | } |
346 | if (0 == te->current_depth) | ||
347 | { | ||
348 | te->uri = GNUNET_malloc (sizeof(struct GNUNET_FS_Uri)); | ||
349 | te->uri->type = chk; | ||
350 | te->uri->data.chk.chk = te->chk_tree[0]; | ||
351 | te->uri->data.chk.file_length = GNUNET_htonll (te->size); | ||
352 | GNUNET_SCHEDULER_add_continuation (te->h->sched, | ||
353 | GNUNET_NO, | ||
354 | te->cont, | ||
355 | te->cls, | ||
356 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | ||
357 | } | ||
358 | } | 358 | } |
359 | 359 | ||
360 | 360 | ||
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, | |||
96 | { | 96 | { |
97 | case GNUNET_FS_STATUS_PUBLISH_PROGRESS: | 97 | case GNUNET_FS_STATUS_PUBLISH_PROGRESS: |
98 | #if DEBUG_VERBOSE | 98 | #if DEBUG_VERBOSE |
99 | printf ("Publish is progressing (%llu/%llu)...\n", | 99 | printf ("Publish is progressing (%llu/%llu at level %u off %llu)...\n", |
100 | (unsigned long long) event->value.publish.completed, | 100 | (unsigned long long) event->value.publish.completed, |
101 | (unsigned long long) event->value.publish.size); | 101 | (unsigned long long) event->value.publish.size, |
102 | event->value.publish.specifics.progress.depth, | ||
103 | (unsigned long long) event->value.publish.specifics.progress.offset); | ||
102 | #endif | 104 | #endif |
103 | break; | 105 | break; |
104 | case GNUNET_FS_STATUS_PUBLISH_COMPLETED: | 106 | case GNUNET_FS_STATUS_PUBLISH_COMPLETED: |
105 | #if DEBUG_VERBOSE | 107 | #if DEBUG_VERBOSE |
106 | printf ("Publish complete.\n"); | 108 | printf ("Publish complete.\n"); |
107 | #endif | 109 | #endif |
108 | GNUNET_FS_publish_stop (publish); | 110 | GNUNET_SCHEDULER_add_continuation (sched, |
109 | publish = NULL; | 111 | GNUNET_NO, |
112 | &abort_publish_task, | ||
113 | NULL, | ||
114 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | ||
110 | fn = GNUNET_DISK_mktemp ("gnunet-download-test-dstXXXXXX"); | 115 | fn = GNUNET_DISK_mktemp ("gnunet-download-test-dstXXXXXX"); |
111 | download = GNUNET_FS_download_start (fs, | 116 | download = GNUNET_FS_download_start (fs, |
112 | event->value.publish.specifics.completed.chk_uri, | 117 | event->value.publish.specifics.completed.chk_uri, |
@@ -123,14 +128,19 @@ progress_cb (void *cls, | |||
123 | #if DEBUG_VERBOSE | 128 | #if DEBUG_VERBOSE |
124 | printf ("Download complete.\n"); | 129 | printf ("Download complete.\n"); |
125 | #endif | 130 | #endif |
126 | GNUNET_FS_download_stop (download, GNUNET_YES); | 131 | GNUNET_SCHEDULER_add_continuation (sched, |
127 | download = NULL; | 132 | GNUNET_NO, |
133 | &abort_download_task, | ||
134 | NULL, | ||
135 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | ||
128 | break; | 136 | break; |
129 | case GNUNET_FS_STATUS_DOWNLOAD_PROGRESS: | 137 | case GNUNET_FS_STATUS_DOWNLOAD_PROGRESS: |
130 | #if DEBUG_VERBOSE | 138 | #if DEBUG_VERBOSE |
131 | printf ("Download is progressing (%llu/%llu)...\n", | 139 | printf ("Download is progressing (%llu/%llu at level %u off %llu)...\n", |
132 | (unsigned long long) event->value.download.completed, | 140 | (unsigned long long) event->value.download.completed, |
133 | (unsigned long long) event->value.download.size); | 141 | (unsigned long long) event->value.download.size, |
142 | event->value.download.specifics.progress.depth, | ||
143 | (unsigned long long) event->value.download.specifics.progress.offset); | ||
134 | #endif | 144 | #endif |
135 | break; | 145 | break; |
136 | case GNUNET_FS_STATUS_PUBLISH_ERROR: | 146 | case GNUNET_FS_STATUS_PUBLISH_ERROR: |