diff options
author | Christian Grothoff <christian@grothoff.org> | 2009-10-19 13:31:03 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2009-10-19 13:31:03 +0000 |
commit | 8da608f0e8391f0159c1e8faf43e8085a9309ce0 (patch) | |
tree | d12ec36ef7f7e6fce12a5c1499069f4c076f5637 /src/fs | |
parent | 6ee357f1ac32f1ca6c8012a2d17f09901eb2ed50 (diff) | |
download | gnunet-8da608f0e8391f0159c1e8faf43e8085a9309ce0.tar.gz gnunet-8da608f0e8391f0159c1e8faf43e8085a9309ce0.zip |
fixes
Diffstat (limited to 'src/fs')
-rw-r--r-- | src/fs/fs_download.c | 18 | ||||
-rw-r--r-- | src/fs/fs_publish.c | 6 | ||||
-rw-r--r-- | src/fs/fs_tree.c | 20 | ||||
-rw-r--r-- | src/fs/test_fs_download.c | 11 | ||||
-rw-r--r-- | src/fs/test_fs_download_data.conf | 3 |
5 files changed, 42 insertions, 16 deletions
diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c index 346857c24..6d3886c70 100644 --- a/src/fs/fs_download.c +++ b/src/fs/fs_download.c | |||
@@ -176,6 +176,13 @@ schedule_block_download (struct GNUNET_FS_DownloadContext *dc, | |||
176 | struct DownloadRequest *sm; | 176 | struct DownloadRequest *sm; |
177 | uint64_t off; | 177 | uint64_t off; |
178 | 178 | ||
179 | #if DEBUG_DOWNLOAD | ||
180 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
181 | "Scheduling download at offset %llu and depth %u for `%s'\n", | ||
182 | (unsigned long long) offset, | ||
183 | depth, | ||
184 | GNUNET_h2s (&chk->query)); | ||
185 | #endif | ||
179 | off = compute_disk_offset (GNUNET_ntohll (dc->uri->data.chk.file_length), | 186 | off = compute_disk_offset (GNUNET_ntohll (dc->uri->data.chk.file_length), |
180 | offset, | 187 | offset, |
181 | depth, | 188 | depth, |
@@ -676,6 +683,12 @@ GNUNET_FS_download_start (struct GNUNET_FS_Handle *h, | |||
676 | GNUNET_break (0); | 683 | GNUNET_break (0); |
677 | return NULL; | 684 | return NULL; |
678 | } | 685 | } |
686 | #if DEBUG_DOWNLOAD | ||
687 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
688 | "Starting download `%s' of %llu bytes\n", | ||
689 | filename, | ||
690 | (unsigned long long) length); | ||
691 | #endif | ||
679 | dc = GNUNET_malloc (sizeof(struct GNUNET_FS_DownloadContext)); | 692 | dc = GNUNET_malloc (sizeof(struct GNUNET_FS_DownloadContext)); |
680 | dc->h = h; | 693 | dc->h = h; |
681 | dc->client = client; | 694 | dc->client = client; |
@@ -717,6 +730,11 @@ GNUNET_FS_download_start (struct GNUNET_FS_Handle *h, | |||
717 | dc->options = options; | 730 | dc->options = options; |
718 | dc->active = GNUNET_CONTAINER_multihashmap_create (1 + (length / DBLOCK_SIZE)); | 731 | dc->active = GNUNET_CONTAINER_multihashmap_create (1 + (length / DBLOCK_SIZE)); |
719 | dc->treedepth = GNUNET_FS_compute_depth (GNUNET_ntohll(dc->uri->data.chk.file_length)); | 732 | dc->treedepth = GNUNET_FS_compute_depth (GNUNET_ntohll(dc->uri->data.chk.file_length)); |
733 | #if DEBUG_DOWNLOAD | ||
734 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
735 | "Download tree has depth %u\n", | ||
736 | dc->treedepth); | ||
737 | #endif | ||
720 | // FIXME: make persistent | 738 | // FIXME: make persistent |
721 | schedule_block_download (dc, | 739 | schedule_block_download (dc, |
722 | &dc->uri->data.chk.chk, | 740 | &dc->uri->data.chk.chk, |
diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c index f8c76c36b..72bbfdfa9 100644 --- a/src/fs/fs_publish.c +++ b/src/fs/fs_publish.c | |||
@@ -483,6 +483,12 @@ block_proc (void *cls, | |||
483 | struct PutContCtx * dpc_cls; | 483 | struct PutContCtx * dpc_cls; |
484 | struct OnDemandBlock odb; | 484 | struct OnDemandBlock odb; |
485 | 485 | ||
486 | #if DEBUG_PUBLISH | ||
487 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
488 | "Publishing block `%s' for offset %llu\n", | ||
489 | GNUNET_h2s (query), | ||
490 | (unsigned long long) offset); | ||
491 | #endif | ||
486 | p = sc->fi_pos; | 492 | p = sc->fi_pos; |
487 | if (NULL == sc->dsh) | 493 | if (NULL == sc->dsh) |
488 | { | 494 | { |
diff --git a/src/fs/fs_tree.c b/src/fs/fs_tree.c index 2108b4831..3dbf478df 100644 --- a/src/fs/fs_tree.c +++ b/src/fs/fs_tree.c | |||
@@ -301,16 +301,6 @@ void GNUNET_FS_tree_encoder_next (struct GNUNET_FS_TreeEncoder * te) | |||
301 | pt_block = &te->chk_tree[te->current_depth * | 301 | pt_block = &te->chk_tree[te->current_depth * |
302 | CHK_PER_INODE]; | 302 | CHK_PER_INODE]; |
303 | } | 303 | } |
304 | off = compute_chk_offset (te->chk_tree_depth - te->current_depth, | ||
305 | te->publish_offset); | ||
306 | mychk = &te->chk_tree[(te->current_depth-1)*CHK_PER_INODE+off]; | ||
307 | GNUNET_CRYPTO_hash (pt_block, pt_size, &mychk->key); | ||
308 | GNUNET_CRYPTO_hash_to_aes_key (&mychk->key, &sk, &iv); | ||
309 | GNUNET_CRYPTO_aes_encrypt (pt_block, | ||
310 | pt_size, | ||
311 | &sk, | ||
312 | &iv, | ||
313 | enc); | ||
314 | if (0 == te->current_depth) | 304 | if (0 == te->current_depth) |
315 | { | 305 | { |
316 | te->uri = GNUNET_malloc (sizeof(struct GNUNET_FS_Uri)); | 306 | te->uri = GNUNET_malloc (sizeof(struct GNUNET_FS_Uri)); |
@@ -324,6 +314,16 @@ void GNUNET_FS_tree_encoder_next (struct GNUNET_FS_TreeEncoder * te) | |||
324 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 314 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
325 | return; | 315 | return; |
326 | } | 316 | } |
317 | off = compute_chk_offset (te->chk_tree_depth - te->current_depth, | ||
318 | te->publish_offset); | ||
319 | mychk = &te->chk_tree[(te->current_depth-1)*CHK_PER_INODE+off]; | ||
320 | GNUNET_CRYPTO_hash (pt_block, pt_size, &mychk->key); | ||
321 | GNUNET_CRYPTO_hash_to_aes_key (&mychk->key, &sk, &iv); | ||
322 | GNUNET_CRYPTO_aes_encrypt (pt_block, | ||
323 | pt_size, | ||
324 | &sk, | ||
325 | &iv, | ||
326 | enc); | ||
327 | if (NULL != te->proc) | 327 | if (NULL != te->proc) |
328 | te->proc (te->cls, | 328 | te->proc (te->cls, |
329 | &mychk->query, | 329 | &mychk->query, |
diff --git a/src/fs/test_fs_download.c b/src/fs/test_fs_download.c index 730720d40..f6fb2a1f2 100644 --- a/src/fs/test_fs_download.c +++ b/src/fs/test_fs_download.c | |||
@@ -29,8 +29,7 @@ | |||
29 | #include "gnunet_arm_service.h" | 29 | #include "gnunet_arm_service.h" |
30 | #include "gnunet_fs_service.h" | 30 | #include "gnunet_fs_service.h" |
31 | 31 | ||
32 | #define DEBUG_VERBOSE 42 | 32 | #define VERBOSE GNUNET_YES |
33 | //GNUNET_NO | ||
34 | 33 | ||
35 | #define START_ARM GNUNET_YES | 34 | #define START_ARM GNUNET_YES |
36 | 35 | ||
@@ -95,7 +94,7 @@ progress_cb (void *cls, | |||
95 | switch (event->status) | 94 | switch (event->status) |
96 | { | 95 | { |
97 | case GNUNET_FS_STATUS_PUBLISH_PROGRESS: | 96 | case GNUNET_FS_STATUS_PUBLISH_PROGRESS: |
98 | #if DEBUG_VERBOSE | 97 | #if VERBOSE |
99 | printf ("Publish is progressing (%llu/%llu at level %u off %llu)...\n", | 98 | printf ("Publish is progressing (%llu/%llu at level %u off %llu)...\n", |
100 | (unsigned long long) event->value.publish.completed, | 99 | (unsigned long long) event->value.publish.completed, |
101 | (unsigned long long) event->value.publish.size, | 100 | (unsigned long long) event->value.publish.size, |
@@ -104,7 +103,7 @@ progress_cb (void *cls, | |||
104 | #endif | 103 | #endif |
105 | break; | 104 | break; |
106 | case GNUNET_FS_STATUS_PUBLISH_COMPLETED: | 105 | case GNUNET_FS_STATUS_PUBLISH_COMPLETED: |
107 | #if DEBUG_VERBOSE | 106 | #if VERBOSE |
108 | printf ("Publish complete.\n"); | 107 | printf ("Publish complete.\n"); |
109 | #endif | 108 | #endif |
110 | GNUNET_SCHEDULER_add_continuation (sched, | 109 | GNUNET_SCHEDULER_add_continuation (sched, |
@@ -125,7 +124,7 @@ progress_cb (void *cls, | |||
125 | GNUNET_assert (download != NULL); | 124 | GNUNET_assert (download != NULL); |
126 | break; | 125 | break; |
127 | case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED: | 126 | case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED: |
128 | #if DEBUG_VERBOSE | 127 | #if VERBOSE |
129 | printf ("Download complete.\n"); | 128 | printf ("Download complete.\n"); |
130 | #endif | 129 | #endif |
131 | GNUNET_SCHEDULER_add_continuation (sched, | 130 | GNUNET_SCHEDULER_add_continuation (sched, |
@@ -135,7 +134,7 @@ progress_cb (void *cls, | |||
135 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 134 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
136 | break; | 135 | break; |
137 | case GNUNET_FS_STATUS_DOWNLOAD_PROGRESS: | 136 | case GNUNET_FS_STATUS_DOWNLOAD_PROGRESS: |
138 | #if DEBUG_VERBOSE | 137 | #if VERBOSE |
139 | printf ("Download is progressing (%llu/%llu at level %u off %llu)...\n", | 138 | printf ("Download is progressing (%llu/%llu at level %u off %llu)...\n", |
140 | (unsigned long long) event->value.download.completed, | 139 | (unsigned long long) event->value.download.completed, |
141 | (unsigned long long) event->value.download.size, | 140 | (unsigned long long) event->value.download.size, |
diff --git a/src/fs/test_fs_download_data.conf b/src/fs/test_fs_download_data.conf index ac90b3203..312c33d22 100644 --- a/src/fs/test_fs_download_data.conf +++ b/src/fs/test_fs_download_data.conf | |||
@@ -18,6 +18,9 @@ PORT = 42466 | |||
18 | HOSTNAME = localhost | 18 | HOSTNAME = localhost |
19 | DEFAULTSERVICES = resolver datastore transport core fs | 19 | DEFAULTSERVICES = resolver datastore transport core fs |
20 | 20 | ||
21 | [datastore] | ||
22 | DEBUG = YES | ||
23 | |||
21 | [statistics] | 24 | [statistics] |
22 | PORT = 42467 | 25 | PORT = 42467 |
23 | HOSTNAME = localhost | 26 | HOSTNAME = localhost |