From ce0a51361bc8a4a5d05fe762c452e879ab607784 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 11 Jul 2010 21:47:50 +0000 Subject: fix 1579 --- src/fs/fs.h | 5 +++++ src/fs/fs_publish.c | 19 +++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) (limited to 'src/fs') diff --git a/src/fs/fs.h b/src/fs/fs.h index 3a0b54d6f..8478f4845 100644 --- a/src/fs/fs.h +++ b/src/fs/fs.h @@ -1301,6 +1301,11 @@ struct GNUNET_FS_PublishContext */ struct GNUNET_FS_FileInformation *fi_pos; + /** + * Non-null if we are currently hashing a file. + */ + struct GNUNET_CRYPTO_FileHashContext *fhc; + /** * Connection to the datastore service. */ diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c index 277a783c5..89d1f84cb 100644 --- a/src/fs/fs_publish.c +++ b/src/fs/fs_publish.c @@ -113,6 +113,11 @@ publish_cleanup (void *cls, { struct GNUNET_FS_PublishContext *pc = cls; + if (pc->fhc != NULL) + { + GNUNET_CRYPTO_hash_file_cancel (pc->fhc); + pc->fhc = NULL; + } GNUNET_FS_file_information_destroy (pc->fi, NULL, NULL); if (pc->namespace != NULL) GNUNET_FS_namespace_delete (pc->namespace, GNUNET_NO); @@ -788,6 +793,7 @@ hash_for_index_cb (void *cls, uint64_t ino; char *fn; + sc->fhc = NULL; p = sc->fi_pos; if (NULL == res) { @@ -1023,12 +1029,12 @@ GNUNET_FS_publish_main_ (void *cls, else { p->start_time = GNUNET_TIME_absolute_get (); - GNUNET_CRYPTO_hash_file (pc->h->sched, - GNUNET_SCHEDULER_PRIORITY_IDLE, - p->filename, - HASHING_BLOCKSIZE, - &hash_for_index_cb, - pc); + pc->fhc = GNUNET_CRYPTO_hash_file (pc->h->sched, + GNUNET_SCHEDULER_PRIORITY_IDLE, + p->filename, + HASHING_BLOCKSIZE, + &hash_for_index_cb, + pc); } return; } @@ -1235,6 +1241,7 @@ GNUNET_FS_publish_start (struct GNUNET_FS_Handle *h, struct GNUNET_FS_PublishContext *ret; struct GNUNET_DATASTORE_Handle *dsh; + GNUNET_assert (NULL != h); if (0 == (options & GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY)) { dsh = GNUNET_DATASTORE_connect (h->cfg, -- cgit v1.2.3