summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2009-10-18 20:47:42 +0000
committerChristian Grothoff <christian@grothoff.org>2009-10-18 20:47:42 +0000
commita1ad98480a419d9261528aa307a98a06942a4a83 (patch)
treed89f63618f65effbbf4b2ceea45c3c191ed7413e
parentec4a74378aed946caaecc32fdfeab01a8f6b1e1c (diff)
fixes
-rw-r--r--src/fs/fs_tree.c26
-rw-r--r--src/fs/test_fs_download.c26
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;i<height;i++)
bds *= CHK_PER_INODE;
- GNUNET_assert (0 == (offset % bds));
ret = offset / bds;
return ret % CHK_PER_INODE;
}
@@ -312,6 +311,19 @@ void GNUNET_FS_tree_encoder_next (struct GNUNET_FS_TreeEncoder * te)
&sk,
&iv,
enc);
+ 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);
+ 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: