fixes
authorChristian Grothoff <christian@grothoff.org>
Mon, 19 Oct 2009 13:31:03 +0000 (13:31 +0000)
committerChristian Grothoff <christian@grothoff.org>
Mon, 19 Oct 2009 13:31:03 +0000 (13:31 +0000)
src/fs/fs_download.c
src/fs/fs_publish.c
src/fs/fs_tree.c
src/fs/test_fs_download.c
src/fs/test_fs_download_data.conf

index 346857c2449a2a13b888b70a470f6c4fbdd7c11a..6d3886c70e8689a4451dcc44d7a0bf060c4eeb1a 100644 (file)
@@ -176,6 +176,13 @@ schedule_block_download (struct GNUNET_FS_DownloadContext *dc,
   struct DownloadRequest *sm;
   uint64_t off;
 
+#if DEBUG_DOWNLOAD
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Scheduling download at offset %llu and depth %u for `%s'\n",
+             (unsigned long long) offset,
+             depth,
+             GNUNET_h2s (&chk->query));
+#endif
   off = compute_disk_offset (GNUNET_ntohll (dc->uri->data.chk.file_length),
                             offset,
                             depth,
@@ -676,6 +683,12 @@ GNUNET_FS_download_start (struct GNUNET_FS_Handle *h,
       GNUNET_break (0);
       return NULL;
     }
+#if DEBUG_DOWNLOAD
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Starting download `%s' of %llu bytes\n",
+             filename,
+             (unsigned long long) length);
+#endif
   dc = GNUNET_malloc (sizeof(struct GNUNET_FS_DownloadContext));
   dc->h = h;
   dc->client = client;
@@ -717,6 +730,11 @@ GNUNET_FS_download_start (struct GNUNET_FS_Handle *h,
   dc->options = options;
   dc->active = GNUNET_CONTAINER_multihashmap_create (1 + (length / DBLOCK_SIZE));
   dc->treedepth = GNUNET_FS_compute_depth (GNUNET_ntohll(dc->uri->data.chk.file_length));
+#if DEBUG_DOWNLOAD
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Download tree has depth %u\n",
+             dc->treedepth);
+#endif
   // FIXME: make persistent
   schedule_block_download (dc, 
                           &dc->uri->data.chk.chk,
index f8c76c36b63390951e902da1751799a53f122d27..72bbfdfa908ae1a89d5514e512de0b8886ff56d1 100644 (file)
@@ -483,6 +483,12 @@ block_proc (void *cls,
   struct PutContCtx * dpc_cls;
   struct OnDemandBlock odb;
 
+#if DEBUG_PUBLISH
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Publishing block `%s' for offset %llu\n",
+             GNUNET_h2s (query),
+             (unsigned long long) offset);
+#endif
   p = sc->fi_pos;
   if (NULL == sc->dsh)
     {
index 2108b48318b336146d4aeab7d25a59f64053ec58..3dbf478df00d41bac41001f5d1ee953cf2aaa4b4 100644 (file)
@@ -301,16 +301,6 @@ void GNUNET_FS_tree_encoder_next (struct GNUNET_FS_TreeEncoder * te)
       pt_block = &te->chk_tree[te->current_depth *
                               CHK_PER_INODE];
     }
-  off = compute_chk_offset (te->chk_tree_depth - te->current_depth,
-                           te->publish_offset);
-  mychk = &te->chk_tree[(te->current_depth-1)*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);
   if (0 == te->current_depth)
     {
       te->uri = GNUNET_malloc (sizeof(struct GNUNET_FS_Uri));
@@ -324,6 +314,16 @@ void GNUNET_FS_tree_encoder_next (struct GNUNET_FS_TreeEncoder * te)
                                         GNUNET_SCHEDULER_REASON_PREREQ_DONE);
       return;
     }
+  off = compute_chk_offset (te->chk_tree_depth - te->current_depth,
+                           te->publish_offset);
+  mychk = &te->chk_tree[(te->current_depth-1)*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);
   if (NULL != te->proc)
     te->proc (te->cls,
              &mychk->query,
index 730720d403b7cf80547396e70ab2f5f952bad76f..f6fb2a1f2e64d18c469d4e17b74c9bf961e28749 100644 (file)
@@ -29,8 +29,7 @@
 #include "gnunet_arm_service.h"
 #include "gnunet_fs_service.h"
 
-#define DEBUG_VERBOSE 42 
-//GNUNET_NO
+#define VERBOSE GNUNET_YES
 
 #define START_ARM GNUNET_YES
 
@@ -95,7 +94,7 @@ progress_cb (void *cls,
   switch (event->status)
     {
     case GNUNET_FS_STATUS_PUBLISH_PROGRESS:
-#if DEBUG_VERBOSE
+#if VERBOSE
       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,
@@ -104,7 +103,7 @@ progress_cb (void *cls,
 #endif
       break;
     case GNUNET_FS_STATUS_PUBLISH_COMPLETED:
-#if DEBUG_VERBOSE
+#if VERBOSE
       printf ("Publish complete.\n");
 #endif
       GNUNET_SCHEDULER_add_continuation (sched,
@@ -125,7 +124,7 @@ progress_cb (void *cls,
       GNUNET_assert (download != NULL);
       break;
     case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED:
-#if DEBUG_VERBOSE
+#if VERBOSE
       printf ("Download complete.\n");
 #endif
       GNUNET_SCHEDULER_add_continuation (sched,
@@ -135,7 +134,7 @@ progress_cb (void *cls,
                                         GNUNET_SCHEDULER_REASON_PREREQ_DONE);
       break;
     case GNUNET_FS_STATUS_DOWNLOAD_PROGRESS:
-#if DEBUG_VERBOSE
+#if VERBOSE
       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,
index ac90b3203cd52cf920a2faec5488869e33d1fa87..312c33d22514e136ca9fbd8ddcb534c0cd76178e 100644 (file)
@@ -18,6 +18,9 @@ PORT = 42466
 HOSTNAME = localhost
 DEFAULTSERVICES = resolver datastore transport core fs
 
+[datastore]
+DEBUG = YES
+
 [statistics]
 PORT = 42467
 HOSTNAME = localhost