diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-07-11 21:47:50 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-07-11 21:47:50 +0000 |
commit | ce0a51361bc8a4a5d05fe762c452e879ab607784 (patch) | |
tree | 28e4486bbe6c50e1399e1ba732f004d8e821a6cb | |
parent | 2c2d9ac07e21dd6c15559bd35033303ae8d83a8c (diff) | |
download | gnunet-ce0a51361bc8a4a5d05fe762c452e879ab607784.tar.gz gnunet-ce0a51361bc8a4a5d05fe762c452e879ab607784.zip |
fix 1579
-rw-r--r-- | src/fs/fs.h | 5 | ||||
-rw-r--r-- | src/fs/fs_publish.c | 19 |
2 files changed, 18 insertions, 6 deletions
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 | |||
@@ -1302,6 +1302,11 @@ struct GNUNET_FS_PublishContext | |||
1302 | struct GNUNET_FS_FileInformation *fi_pos; | 1302 | struct GNUNET_FS_FileInformation *fi_pos; |
1303 | 1303 | ||
1304 | /** | 1304 | /** |
1305 | * Non-null if we are currently hashing a file. | ||
1306 | */ | ||
1307 | struct GNUNET_CRYPTO_FileHashContext *fhc; | ||
1308 | |||
1309 | /** | ||
1305 | * Connection to the datastore service. | 1310 | * Connection to the datastore service. |
1306 | */ | 1311 | */ |
1307 | struct GNUNET_DATASTORE_Handle *dsh; | 1312 | struct GNUNET_DATASTORE_Handle *dsh; |
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, | |||
113 | { | 113 | { |
114 | struct GNUNET_FS_PublishContext *pc = cls; | 114 | struct GNUNET_FS_PublishContext *pc = cls; |
115 | 115 | ||
116 | if (pc->fhc != NULL) | ||
117 | { | ||
118 | GNUNET_CRYPTO_hash_file_cancel (pc->fhc); | ||
119 | pc->fhc = NULL; | ||
120 | } | ||
116 | GNUNET_FS_file_information_destroy (pc->fi, NULL, NULL); | 121 | GNUNET_FS_file_information_destroy (pc->fi, NULL, NULL); |
117 | if (pc->namespace != NULL) | 122 | if (pc->namespace != NULL) |
118 | GNUNET_FS_namespace_delete (pc->namespace, GNUNET_NO); | 123 | GNUNET_FS_namespace_delete (pc->namespace, GNUNET_NO); |
@@ -788,6 +793,7 @@ hash_for_index_cb (void *cls, | |||
788 | uint64_t ino; | 793 | uint64_t ino; |
789 | char *fn; | 794 | char *fn; |
790 | 795 | ||
796 | sc->fhc = NULL; | ||
791 | p = sc->fi_pos; | 797 | p = sc->fi_pos; |
792 | if (NULL == res) | 798 | if (NULL == res) |
793 | { | 799 | { |
@@ -1023,12 +1029,12 @@ GNUNET_FS_publish_main_ (void *cls, | |||
1023 | else | 1029 | else |
1024 | { | 1030 | { |
1025 | p->start_time = GNUNET_TIME_absolute_get (); | 1031 | p->start_time = GNUNET_TIME_absolute_get (); |
1026 | GNUNET_CRYPTO_hash_file (pc->h->sched, | 1032 | pc->fhc = GNUNET_CRYPTO_hash_file (pc->h->sched, |
1027 | GNUNET_SCHEDULER_PRIORITY_IDLE, | 1033 | GNUNET_SCHEDULER_PRIORITY_IDLE, |
1028 | p->filename, | 1034 | p->filename, |
1029 | HASHING_BLOCKSIZE, | 1035 | HASHING_BLOCKSIZE, |
1030 | &hash_for_index_cb, | 1036 | &hash_for_index_cb, |
1031 | pc); | 1037 | pc); |
1032 | } | 1038 | } |
1033 | return; | 1039 | return; |
1034 | } | 1040 | } |
@@ -1235,6 +1241,7 @@ GNUNET_FS_publish_start (struct GNUNET_FS_Handle *h, | |||
1235 | struct GNUNET_FS_PublishContext *ret; | 1241 | struct GNUNET_FS_PublishContext *ret; |
1236 | struct GNUNET_DATASTORE_Handle *dsh; | 1242 | struct GNUNET_DATASTORE_Handle *dsh; |
1237 | 1243 | ||
1244 | GNUNET_assert (NULL != h); | ||
1238 | if (0 == (options & GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY)) | 1245 | if (0 == (options & GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY)) |
1239 | { | 1246 | { |
1240 | dsh = GNUNET_DATASTORE_connect (h->cfg, | 1247 | dsh = GNUNET_DATASTORE_connect (h->cfg, |