aboutsummaryrefslogtreecommitdiff
path: root/src/fs/fs_publish.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-01-20 14:20:30 +0000
committerChristian Grothoff <christian@grothoff.org>2011-01-20 14:20:30 +0000
commitc9432075d84d3c50171367e7d648a3a09f431994 (patch)
tree816f97d3601f6f255354267225c3b43b076fdac7 /src/fs/fs_publish.c
parent81dfe20c8ee82d202244766f2914683a63d078ca (diff)
downloadgnunet-c9432075d84d3c50171367e7d648a3a09f431994.tar.gz
gnunet-c9432075d84d3c50171367e7d648a3a09f431994.zip
major rewrite of fs_download, hopefully fixing 1641
Diffstat (limited to 'src/fs/fs_publish.c')
-rw-r--r--src/fs/fs_publish.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c
index bc75c2a40..6c933a37d 100644
--- a/src/fs/fs_publish.c
+++ b/src/fs/fs_publish.c
@@ -457,6 +457,7 @@ encode_cont (void *cls,
457 struct GNUNET_FS_FileInformation *p; 457 struct GNUNET_FS_FileInformation *p;
458 struct GNUNET_FS_ProgressInfo pi; 458 struct GNUNET_FS_ProgressInfo pi;
459 char *emsg; 459 char *emsg;
460 uint64_t flen;
460 461
461 p = sc->fi_pos; 462 p = sc->fi_pos;
462 GNUNET_FS_tree_encoder_finish (p->te, 463 GNUNET_FS_tree_encoder_finish (p->te,
@@ -484,13 +485,13 @@ encode_cont (void *cls,
484 "Finished with tree encoder\n"); 485 "Finished with tree encoder\n");
485#endif 486#endif
486 /* final progress event */ 487 /* final progress event */
488 flen = GNUNET_FS_uri_chk_get_file_size (p->chk_uri);
487 pi.status = GNUNET_FS_STATUS_PUBLISH_PROGRESS; 489 pi.status = GNUNET_FS_STATUS_PUBLISH_PROGRESS;
488 pi.value.publish.specifics.progress.data = NULL; 490 pi.value.publish.specifics.progress.data = NULL;
489 pi.value.publish.specifics.progress.offset = GNUNET_FS_uri_chk_get_file_size (p->chk_uri); 491 pi.value.publish.specifics.progress.offset = flen;
490 pi.value.publish.specifics.progress.data_len = 0; 492 pi.value.publish.specifics.progress.data_len = 0;
491 pi.value.publish.specifics.progress.depth = 0; 493 pi.value.publish.specifics.progress.depth = GNUNET_FS_compute_depth (flen);
492 p->client_info = GNUNET_FS_publish_make_status_ (&pi, sc, p, 494 p->client_info = GNUNET_FS_publish_make_status_ (&pi, sc, p, flen);
493 GNUNET_FS_uri_chk_get_file_size (p->chk_uri));
494 495
495 /* continue with main */ 496 /* continue with main */
496 sc->upload_task 497 sc->upload_task
@@ -507,18 +508,18 @@ encode_cont (void *cls,
507 * or (on error) "GNUNET_FS_tree_encode_finish". 508 * or (on error) "GNUNET_FS_tree_encode_finish".
508 * 509 *
509 * @param cls closure 510 * @param cls closure
510 * @param query the query for the block (key for lookup in the datastore) 511 * @param chk content hash key for the block
511 * @param offset offset of the block in the file 512 * @param offset offset of the block in the file
512 * @param depth depth of the block in the file 513 * @param depth depth of the block in the file, 0 for DBLOCK
513 * @param type type of the block (IBLOCK or DBLOCK) 514 * @param type type of the block (IBLOCK or DBLOCK)
514 * @param block the (encrypted) block 515 * @param block the (encrypted) block
515 * @param block_size size of block (in bytes) 516 * @param block_size size of block (in bytes)
516 */ 517 */
517static void 518static void
518block_proc (void *cls, 519block_proc (void *cls,
519 const GNUNET_HashCode *query, 520 const struct ContentHashKey *chk,
520 uint64_t offset, 521 uint64_t offset,
521 unsigned int depth, 522 unsigned int depth,
522 enum GNUNET_BLOCK_Type type, 523 enum GNUNET_BLOCK_Type type,
523 const void *block, 524 const void *block,
524 uint16_t block_size) 525 uint16_t block_size)
@@ -556,7 +557,7 @@ block_proc (void *cls,
556#if DEBUG_PUBLISH 557#if DEBUG_PUBLISH
557 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 558 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
558 "Indexing block `%s' for offset %llu with index size %u\n", 559 "Indexing block `%s' for offset %llu with index size %u\n",
559 GNUNET_h2s (query), 560 GNUNET_h2s (&chk->query),
560 (unsigned long long) offset, 561 (unsigned long long) offset,
561 sizeof (struct OnDemandBlock)); 562 sizeof (struct OnDemandBlock));
562#endif 563#endif
@@ -564,7 +565,7 @@ block_proc (void *cls,
564 odb.file_id = p->data.file.file_id; 565 odb.file_id = p->data.file.file_id;
565 GNUNET_DATASTORE_put (sc->dsh, 566 GNUNET_DATASTORE_put (sc->dsh,
566 (p->is_directory) ? 0 : sc->rid, 567 (p->is_directory) ? 0 : sc->rid,
567 query, 568 &chk->query,
568 sizeof (struct OnDemandBlock), 569 sizeof (struct OnDemandBlock),
569 &odb, 570 &odb,
570 GNUNET_BLOCK_TYPE_FS_ONDEMAND, 571 GNUNET_BLOCK_TYPE_FS_ONDEMAND,
@@ -580,13 +581,13 @@ block_proc (void *cls,
580#if DEBUG_PUBLISH 581#if DEBUG_PUBLISH
581 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 582 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
582 "Publishing block `%s' for offset %llu with size %u\n", 583 "Publishing block `%s' for offset %llu with size %u\n",
583 GNUNET_h2s (query), 584 GNUNET_h2s (&chk->query),
584 (unsigned long long) offset, 585 (unsigned long long) offset,
585 (unsigned int) block_size); 586 (unsigned int) block_size);
586#endif 587#endif
587 GNUNET_DATASTORE_put (sc->dsh, 588 GNUNET_DATASTORE_put (sc->dsh,
588 (p->is_directory) ? 0 : sc->rid, 589 (p->is_directory) ? 0 : sc->rid,
589 query, 590 &chk->query,
590 block_size, 591 block_size,
591 block, 592 block,
592 type, 593 type,
@@ -608,7 +609,7 @@ block_proc (void *cls,
608 * @param offset where are we in the file 609 * @param offset where are we in the file
609 * @param pt_block plaintext of the currently processed block 610 * @param pt_block plaintext of the currently processed block
610 * @param pt_size size of pt_block 611 * @param pt_size size of pt_block
611 * @param depth depth of the block in the tree 612 * @param depth depth of the block in the tree, 0 for DBLOCK
612 */ 613 */
613static void 614static void
614progress_proc (void *cls, 615progress_proc (void *cls,