aboutsummaryrefslogtreecommitdiff
path: root/src/fs/fs_publish.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/fs_publish.c')
-rw-r--r--src/fs/fs_publish.c50
1 files changed, 35 insertions, 15 deletions
diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c
index 211f800e6..d9c732ee8 100644
--- a/src/fs/fs_publish.c
+++ b/src/fs/fs_publish.c
@@ -112,7 +112,8 @@ publish_cleanup (struct GNUNET_FS_PublishContext *pc)
112 * @param msg error message (or NULL) 112 * @param msg error message (or NULL)
113 */ 113 */
114static void 114static void
115ds_put_cont (void *cls, int success, 115ds_put_cont (void *cls,
116 int success,
116 struct GNUNET_TIME_Absolute min_expiration, 117 struct GNUNET_TIME_Absolute min_expiration,
117 const char *msg) 118 const char *msg)
118{ 119{
@@ -130,14 +131,19 @@ ds_put_cont (void *cls, int success,
130 pi.value.publish.specifics.error.message = pc->fi_pos->emsg; 131 pi.value.publish.specifics.error.message = pc->fi_pos->emsg;
131 pc->fi_pos->client_info = 132 pc->fi_pos->client_info =
132 GNUNET_FS_publish_make_status_ (&pi, pc, pc->fi_pos, 0); 133 GNUNET_FS_publish_make_status_ (&pi, pc, pc->fi_pos, 0);
133 if ((pc->fi_pos->is_directory != GNUNET_YES) && 134 if ((GNUNET_YES != pc->fi_pos->is_directory) &&
134 (pc->fi_pos->filename != NULL) && 135 (NULL != pc->fi_pos->filename) &&
135 (pc->fi_pos->data.file.do_index == GNUNET_YES)) 136 (GNUNET_YES == pc->any_done) &&
137 (GNUNET_YES == pc->fi_pos->data.file.do_index))
136 { 138 {
137 /* run unindex to clean up */ 139 /* run unindex to clean up */
138 GNUNET_FS_unindex_start (pc->h, pc->fi_pos->filename, NULL); 140 GNUNET_FS_unindex_start (pc->h,
141 pc->fi_pos->filename,
142 NULL);
139 } 143 }
144 return;
140 } 145 }
146 pc->any_done = GNUNET_YES;
141 GNUNET_assert (NULL == pc->upload_task); 147 GNUNET_assert (NULL == pc->upload_task);
142 pc->upload_task = 148 pc->upload_task =
143 GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_BACKGROUND, 149 GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_BACKGROUND,
@@ -506,26 +512,40 @@ block_proc (void *cls,
506 odb.file_id = p->data.file.file_id; 512 odb.file_id = p->data.file.file_id;
507 GNUNET_assert (pc->qre == NULL); 513 GNUNET_assert (pc->qre == NULL);
508 pc->qre = 514 pc->qre =
509 GNUNET_DATASTORE_put (pc->dsh, (p->is_directory == GNUNET_YES) ? 0 : pc->rid, 515 GNUNET_DATASTORE_put (pc->dsh,
510 &chk->query, sizeof (struct OnDemandBlock), &odb, 516 (p->is_directory == GNUNET_YES) ? 0 : pc->rid,
517 &chk->query,
518 sizeof (struct OnDemandBlock),
519 &odb,
511 GNUNET_BLOCK_TYPE_FS_ONDEMAND, 520 GNUNET_BLOCK_TYPE_FS_ONDEMAND,
512 p->bo.content_priority, p->bo.anonymity_level, 521 p->bo.content_priority,
513 p->bo.replication_level, p->bo.expiration_time, 522 p->bo.anonymity_level,
514 -2, 1, GNUNET_CONSTANTS_SERVICE_TIMEOUT, 523 p->bo.replication_level,
524 p->bo.expiration_time,
525 -2, 1,
526 GNUNET_CONSTANTS_SERVICE_TIMEOUT,
515 &ds_put_cont, pc); 527 &ds_put_cont, pc);
516 return; 528 return;
517 } 529 }
518 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 530 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
519 "Publishing block `%s' for offset %llu with size %u\n", 531 "Publishing block `%s' for offset %llu with size %u\n",
520 GNUNET_h2s (&chk->query), (unsigned long long) offset, 532 GNUNET_h2s (&chk->query),
533 (unsigned long long) offset,
521 (unsigned int) block_size); 534 (unsigned int) block_size);
522 GNUNET_assert (pc->qre == NULL); 535 GNUNET_assert (pc->qre == NULL);
523 pc->qre = 536 pc->qre =
524 GNUNET_DATASTORE_put (pc->dsh, (p->is_directory == GNUNET_YES) ? 0 : pc->rid, 537 GNUNET_DATASTORE_put (pc->dsh, (p->is_directory == GNUNET_YES) ? 0 : pc->rid,
525 &chk->query, block_size, block, type, 538 &chk->query,
526 p->bo.content_priority, p->bo.anonymity_level, 539 block_size,
527 p->bo.replication_level, p->bo.expiration_time, -2, 540 block,
528 1, GNUNET_CONSTANTS_SERVICE_TIMEOUT, &ds_put_cont, 541 type,
542 p->bo.content_priority,
543 p->bo.anonymity_level,
544 p->bo.replication_level,
545 p->bo.expiration_time,
546 -2, 1,
547 GNUNET_CONSTANTS_SERVICE_TIMEOUT,
548 &ds_put_cont,
529 pc); 549 pc);
530} 550}
531 551