#include "gnunet_constants.h"
#include "gnunet_fs_service.h"
#include "fs.h"
+#include "fs_tree.h"
#define DEBUG_DOWNLOAD GNUNET_YES
dc->anonymity = anonymity;
dc->options = options;
dc->active = GNUNET_CONTAINER_multihashmap_create (1 + (length / DBLOCK_SIZE));
- // FIXME: calculate tree depth
+ dc->treedepth = GNUNET_FS_compute_depth (GNUNET_ntohll(dc->uri->data.chk.file_length));
// FIXME: make persistent
schedule_block_download (dc,
&dc->uri->data.chk.chk,
* @param flen file length for which to compute the depth
* @return depth of the tree
*/
-static unsigned int
-compute_depth (uint64_t flen)
+unsigned int
+GNUNET_FS_compute_depth (uint64_t flen)
{
unsigned int treeDepth;
uint64_t fl;
te->proc = proc;
te->progress = progress;
te->cont = cont;
- te->chk_tree_depth = compute_depth (size);
+ te->chk_tree_depth = GNUNET_FS_compute_depth (size);
te->current_depth = te->chk_tree_depth;
te->chk_tree = GNUNET_malloc (te->chk_tree_depth *
CHK_PER_INODE *
#include "fs.h"
+/**
+ * Compute the depth of the CHK tree.
+ *
+ * @param flen file length for which to compute the depth
+ * @return depth of the tree
+ */
+unsigned int
+GNUNET_FS_compute_depth (uint64_t flen);
+
+
/**
* Context for an ECRS-based file encoder that computes
* the Merkle-ish-CHK tree.