diff options
author | Christian Grothoff <christian@grothoff.org> | 2009-09-05 21:01:12 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2009-09-05 21:01:12 +0000 |
commit | 0dfe519c70ef2c40c8f63499c521c0885af37cc2 (patch) | |
tree | 93ef6e3d939dc299d26479fc52d4bdbb590da830 /src | |
parent | 9e645511bbd3775bd5c872eb5e58439676a59199 (diff) | |
download | gnunet-0dfe519c70ef2c40c8f63499c521c0885af37cc2.tar.gz gnunet-0dfe519c70ef2c40c8f63499c521c0885af37cc2.zip |
towards having download
Diffstat (limited to 'src')
-rw-r--r-- | src/fs/fs_download.c | 3 | ||||
-rw-r--r-- | src/fs/fs_tree.c | 6 | ||||
-rw-r--r-- | src/fs/fs_tree.h | 10 |
3 files changed, 15 insertions, 4 deletions
diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c index 323be8805..904244dbb 100644 --- a/src/fs/fs_download.c +++ b/src/fs/fs_download.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include "gnunet_constants.h" | 33 | #include "gnunet_constants.h" |
34 | #include "gnunet_fs_service.h" | 34 | #include "gnunet_fs_service.h" |
35 | #include "fs.h" | 35 | #include "fs.h" |
36 | #include "fs_tree.h" | ||
36 | 37 | ||
37 | #define DEBUG_DOWNLOAD GNUNET_YES | 38 | #define DEBUG_DOWNLOAD GNUNET_YES |
38 | 39 | ||
@@ -388,7 +389,7 @@ GNUNET_FS_file_download_start (struct GNUNET_FS_Handle *h, | |||
388 | dc->anonymity = anonymity; | 389 | dc->anonymity = anonymity; |
389 | dc->options = options; | 390 | dc->options = options; |
390 | dc->active = GNUNET_CONTAINER_multihashmap_create (1 + (length / DBLOCK_SIZE)); | 391 | dc->active = GNUNET_CONTAINER_multihashmap_create (1 + (length / DBLOCK_SIZE)); |
391 | // FIXME: calculate tree depth | 392 | dc->treedepth = GNUNET_FS_compute_depth (GNUNET_ntohll(dc->uri->data.chk.file_length)); |
392 | // FIXME: make persistent | 393 | // FIXME: make persistent |
393 | schedule_block_download (dc, | 394 | schedule_block_download (dc, |
394 | &dc->uri->data.chk.chk, | 395 | &dc->uri->data.chk.chk, |
diff --git a/src/fs/fs_tree.c b/src/fs/fs_tree.c index f5205f082..d151eb086 100644 --- a/src/fs/fs_tree.c +++ b/src/fs/fs_tree.c | |||
@@ -121,8 +121,8 @@ struct GNUNET_FS_TreeEncoder | |||
121 | * @param flen file length for which to compute the depth | 121 | * @param flen file length for which to compute the depth |
122 | * @return depth of the tree | 122 | * @return depth of the tree |
123 | */ | 123 | */ |
124 | static unsigned int | 124 | unsigned int |
125 | compute_depth (uint64_t flen) | 125 | GNUNET_FS_compute_depth (uint64_t flen) |
126 | { | 126 | { |
127 | unsigned int treeDepth; | 127 | unsigned int treeDepth; |
128 | uint64_t fl; | 128 | uint64_t fl; |
@@ -179,7 +179,7 @@ GNUNET_FS_tree_encoder_create (struct GNUNET_FS_Handle *h, | |||
179 | te->proc = proc; | 179 | te->proc = proc; |
180 | te->progress = progress; | 180 | te->progress = progress; |
181 | te->cont = cont; | 181 | te->cont = cont; |
182 | te->chk_tree_depth = compute_depth (size); | 182 | te->chk_tree_depth = GNUNET_FS_compute_depth (size); |
183 | te->current_depth = te->chk_tree_depth; | 183 | te->current_depth = te->chk_tree_depth; |
184 | te->chk_tree = GNUNET_malloc (te->chk_tree_depth * | 184 | te->chk_tree = GNUNET_malloc (te->chk_tree_depth * |
185 | CHK_PER_INODE * | 185 | CHK_PER_INODE * |
diff --git a/src/fs/fs_tree.h b/src/fs/fs_tree.h index 47d383fb5..4186a4e21 100644 --- a/src/fs/fs_tree.h +++ b/src/fs/fs_tree.h | |||
@@ -35,6 +35,16 @@ | |||
35 | #include "fs.h" | 35 | #include "fs.h" |
36 | 36 | ||
37 | /** | 37 | /** |
38 | * Compute the depth of the CHK tree. | ||
39 | * | ||
40 | * @param flen file length for which to compute the depth | ||
41 | * @return depth of the tree | ||
42 | */ | ||
43 | unsigned int | ||
44 | GNUNET_FS_compute_depth (uint64_t flen); | ||
45 | |||
46 | |||
47 | /** | ||
38 | * Context for an ECRS-based file encoder that computes | 48 | * Context for an ECRS-based file encoder that computes |
39 | * the Merkle-ish-CHK tree. | 49 | * the Merkle-ish-CHK tree. |
40 | */ | 50 | */ |