-fixes
[oweals/gnunet.git] / src / fs / fs_tree.c
index fc04446c9a7a472c8098a5f35d7d01bc2a6fd63a..a055bcd40a990f785e320d91be39498cf5038717 100644 (file)
@@ -27,7 +27,6 @@
 #include "platform.h"
 #include "fs_tree.h"
 
-#define DEBUG_TREE GNUNET_EXTRA_LOGGING
 
 /**
  * Context for an ECRS-based file encoder that computes
@@ -288,6 +287,10 @@ GNUNET_FS_tree_encoder_create (struct GNUNET_FS_Handle *h, uint64_t size,
   te->chk_tree =
       GNUNET_malloc (te->chk_tree_depth * CHK_PER_INODE *
                      sizeof (struct ContentHashKey));
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Created tree encoder for file with %llu bytes and depth %u\n",
+             (unsigned long long) size,
+             te->chk_tree_depth);
   return te;
 }
 
@@ -341,10 +344,8 @@ GNUNET_FS_tree_encoder_next (struct GNUNET_FS_TreeEncoder *te)
   if (te->chk_tree_depth == te->current_depth)
   {
     off = CHK_PER_INODE * (te->chk_tree_depth - 1);
-#if DEBUG_TREE
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "TE done, reading CHK `%s' from %u\n",
                 GNUNET_h2s (&te->chk_tree[off].query), off);
-#endif
     te->uri = GNUNET_malloc (sizeof (struct GNUNET_FS_Uri));
     te->uri->type = chk;
     te->uri->data.chk.chk = te->chk_tree[off];
@@ -360,8 +361,7 @@ GNUNET_FS_tree_encoder_next (struct GNUNET_FS_TreeEncoder *te)
     if (pt_size !=
         te->reader (te->cls, te->publish_offset, pt_size, iob, &te->emsg))
     {
-      GNUNET_SCHEDULER_add_continuation (te->cont, te->cls,
-                                         GNUNET_SCHEDULER_REASON_TIMEOUT);
+      te->cont (te->cls, NULL);
       te->in_next = GNUNET_NO;
       return;
     }
@@ -375,23 +375,19 @@ GNUNET_FS_tree_encoder_next (struct GNUNET_FS_TreeEncoder *te)
     pt_block = &te->chk_tree[(te->current_depth - 1) * CHK_PER_INODE];
   }
   off = compute_chk_offset (te->current_depth, te->publish_offset);
-#if DEBUG_TREE
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "TE is at offset %llu and depth %u with block size %u and target-CHK-offset %u\n",
               (unsigned long long) te->publish_offset, te->current_depth,
               (unsigned int) pt_size, (unsigned int) off);
-#endif
   mychk = &te->chk_tree[te->current_depth * CHK_PER_INODE + off];
   GNUNET_CRYPTO_hash (pt_block, pt_size, &mychk->key);
   GNUNET_CRYPTO_hash_to_aes_key (&mychk->key, &sk, &iv);
   GNUNET_CRYPTO_aes_encrypt (pt_block, pt_size, &sk, &iv, enc);
   GNUNET_CRYPTO_hash (enc, pt_size, &mychk->query);
-#if DEBUG_TREE
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "TE calculates query to be `%s', stored at %u\n",
               GNUNET_h2s (&mychk->query),
               te->current_depth * CHK_PER_INODE + off);
-#endif
   if (NULL != te->proc)
     te->proc (te->cls, mychk, te->publish_offset, te->current_depth,
               (0 ==