diff options
-rw-r--r-- | src/fs/fs_api.c | 17 | ||||
-rw-r--r-- | src/fs/fs_api.h | 8 | ||||
-rw-r--r-- | src/fs/fs_file_information.c | 5 | ||||
-rw-r--r-- | src/fs/fs_publish.c | 102 | ||||
-rw-r--r-- | src/fs/gnunet-publish.c | 147 | ||||
-rw-r--r-- | src/fs/test_fs_uri.c | 6 |
6 files changed, 200 insertions, 85 deletions
diff --git a/src/fs/fs_api.c b/src/fs/fs_api.c index 7b800c1f1..ab04b86b7 100644 --- a/src/fs/fs_api.c +++ b/src/fs/fs_api.c | |||
@@ -873,6 +873,7 @@ deserialize_fi_node (struct GNUNET_FS_Handle *h, | |||
873 | char b; | 873 | char b; |
874 | char *ksks; | 874 | char *ksks; |
875 | char *chks; | 875 | char *chks; |
876 | char *skss; | ||
876 | char *filename; | 877 | char *filename; |
877 | uint32_t dsize; | 878 | uint32_t dsize; |
878 | 879 | ||
@@ -885,6 +886,7 @@ deserialize_fi_node (struct GNUNET_FS_Handle *h, | |||
885 | ret->h = h; | 886 | ret->h = h; |
886 | ksks = NULL; | 887 | ksks = NULL; |
887 | chks = NULL; | 888 | chks = NULL; |
889 | skss = NULL; | ||
888 | filename = NULL; | 890 | filename = NULL; |
889 | if ((GNUNET_OK != GNUNET_BIO_read_meta_data (rh, "metadata", &ret->meta)) || | 891 | if ((GNUNET_OK != GNUNET_BIO_read_meta_data (rh, "metadata", &ret->meta)) || |
890 | (GNUNET_OK != GNUNET_BIO_read_string (rh, "ksk-uri", &ksks, 32 * 1024)) || | 892 | (GNUNET_OK != GNUNET_BIO_read_string (rh, "ksk-uri", &ksks, 32 * 1024)) || |
@@ -895,6 +897,10 @@ deserialize_fi_node (struct GNUNET_FS_Handle *h, | |||
895 | ( (NULL != chks) && | 897 | ( (NULL != chks) && |
896 | ( (NULL == (ret->chk_uri = GNUNET_FS_uri_parse (chks, NULL))) || | 898 | ( (NULL == (ret->chk_uri = GNUNET_FS_uri_parse (chks, NULL))) || |
897 | (GNUNET_YES != GNUNET_FS_uri_test_chk (ret->chk_uri))) ) || | 899 | (GNUNET_YES != GNUNET_FS_uri_test_chk (ret->chk_uri))) ) || |
900 | (GNUNET_OK != GNUNET_BIO_read_string (rh, "sks-uri", &skss, 1024)) || | ||
901 | ( (NULL != skss) && | ||
902 | ( (NULL == (ret->sks_uri = GNUNET_FS_uri_parse (skss, NULL))) || | ||
903 | (GNUNET_YES != GNUNET_FS_uri_test_sks (ret->sks_uri))) ) || | ||
898 | (GNUNET_OK != read_start_time (rh, &ret->start_time)) || | 904 | (GNUNET_OK != read_start_time (rh, &ret->start_time)) || |
899 | (GNUNET_OK != GNUNET_BIO_read_string (rh, "emsg", &ret->emsg, 16 * 1024)) | 905 | (GNUNET_OK != GNUNET_BIO_read_string (rh, "emsg", &ret->emsg, 16 * 1024)) |
900 | || (GNUNET_OK != | 906 | || (GNUNET_OK != |
@@ -1054,11 +1060,13 @@ deserialize_fi_node (struct GNUNET_FS_Handle *h, | |||
1054 | filename = NULL; | 1060 | filename = NULL; |
1055 | } | 1061 | } |
1056 | GNUNET_free_non_null (ksks); | 1062 | GNUNET_free_non_null (ksks); |
1063 | GNUNET_free_non_null (skss); | ||
1057 | GNUNET_free_non_null (chks); | 1064 | GNUNET_free_non_null (chks); |
1058 | return ret; | 1065 | return ret; |
1059 | cleanup: | 1066 | cleanup: |
1060 | GNUNET_free_non_null (ksks); | 1067 | GNUNET_free_non_null (ksks); |
1061 | GNUNET_free_non_null (chks); | 1068 | GNUNET_free_non_null (chks); |
1069 | GNUNET_free_non_null (skss); | ||
1062 | GNUNET_free_non_null (filename); | 1070 | GNUNET_free_non_null (filename); |
1063 | GNUNET_FS_file_information_destroy (ret, NULL, NULL); | 1071 | GNUNET_FS_file_information_destroy (ret, NULL, NULL); |
1064 | return NULL; | 1072 | return NULL; |
@@ -1267,6 +1275,7 @@ GNUNET_FS_file_information_sync_ (struct GNUNET_FS_FileInformation *fi) | |||
1267 | char b; | 1275 | char b; |
1268 | char *ksks; | 1276 | char *ksks; |
1269 | char *chks; | 1277 | char *chks; |
1278 | char *skss; | ||
1270 | 1279 | ||
1271 | if (NULL == fi->serialization) | 1280 | if (NULL == fi->serialization) |
1272 | fi->serialization = | 1281 | fi->serialization = |
@@ -1299,10 +1308,15 @@ GNUNET_FS_file_information_sync_ (struct GNUNET_FS_FileInformation *fi) | |||
1299 | chks = GNUNET_FS_uri_to_string (fi->chk_uri); | 1308 | chks = GNUNET_FS_uri_to_string (fi->chk_uri); |
1300 | else | 1309 | else |
1301 | chks = NULL; | 1310 | chks = NULL; |
1311 | if (NULL != fi->sks_uri) | ||
1312 | skss = GNUNET_FS_uri_to_string (fi->sks_uri); | ||
1313 | else | ||
1314 | skss = NULL; | ||
1302 | if ((GNUNET_OK != GNUNET_BIO_write (wh, &b, sizeof (b))) || | 1315 | if ((GNUNET_OK != GNUNET_BIO_write (wh, &b, sizeof (b))) || |
1303 | (GNUNET_OK != GNUNET_BIO_write_meta_data (wh, fi->meta)) || | 1316 | (GNUNET_OK != GNUNET_BIO_write_meta_data (wh, fi->meta)) || |
1304 | (GNUNET_OK != GNUNET_BIO_write_string (wh, ksks)) || | 1317 | (GNUNET_OK != GNUNET_BIO_write_string (wh, ksks)) || |
1305 | (GNUNET_OK != GNUNET_BIO_write_string (wh, chks)) || | 1318 | (GNUNET_OK != GNUNET_BIO_write_string (wh, chks)) || |
1319 | (GNUNET_OK != GNUNET_BIO_write_string (wh, skss)) || | ||
1306 | (GNUNET_OK != write_start_time (wh, fi->start_time)) || | 1320 | (GNUNET_OK != write_start_time (wh, fi->start_time)) || |
1307 | (GNUNET_OK != GNUNET_BIO_write_string (wh, fi->emsg)) || | 1321 | (GNUNET_OK != GNUNET_BIO_write_string (wh, fi->emsg)) || |
1308 | (GNUNET_OK != GNUNET_BIO_write_string (wh, fi->filename)) || | 1322 | (GNUNET_OK != GNUNET_BIO_write_string (wh, fi->filename)) || |
@@ -1319,6 +1333,8 @@ GNUNET_FS_file_information_sync_ (struct GNUNET_FS_FileInformation *fi) | |||
1319 | chks = NULL; | 1333 | chks = NULL; |
1320 | GNUNET_free_non_null (ksks); | 1334 | GNUNET_free_non_null (ksks); |
1321 | ksks = NULL; | 1335 | ksks = NULL; |
1336 | GNUNET_free_non_null (skss); | ||
1337 | skss = NULL; | ||
1322 | 1338 | ||
1323 | switch (b) | 1339 | switch (b) |
1324 | { | 1340 | { |
@@ -1410,6 +1426,7 @@ cleanup: | |||
1410 | (void) GNUNET_BIO_write_close (wh); | 1426 | (void) GNUNET_BIO_write_close (wh); |
1411 | GNUNET_free_non_null (chks); | 1427 | GNUNET_free_non_null (chks); |
1412 | GNUNET_free_non_null (ksks); | 1428 | GNUNET_free_non_null (ksks); |
1429 | GNUNET_free_non_null (skss); | ||
1413 | fn = get_serialization_file_name (fi->h, GNUNET_FS_SYNC_PATH_FILE_INFO, | 1430 | fn = get_serialization_file_name (fi->h, GNUNET_FS_SYNC_PATH_FILE_INFO, |
1414 | fi->serialization); | 1431 | fi->serialization); |
1415 | if (NULL != fn) | 1432 | if (NULL != fn) |
diff --git a/src/fs/fs_api.h b/src/fs/fs_api.h index 77e26e155..2cbbade8f 100644 --- a/src/fs/fs_api.h +++ b/src/fs/fs_api.h | |||
@@ -269,6 +269,12 @@ struct GNUNET_FS_FileInformation | |||
269 | struct GNUNET_FS_Uri *chk_uri; | 269 | struct GNUNET_FS_Uri *chk_uri; |
270 | 270 | ||
271 | /** | 271 | /** |
272 | * SKS URI for this file or directory. NULL if | ||
273 | * we have not yet computed it. | ||
274 | */ | ||
275 | struct GNUNET_FS_Uri *sks_uri; | ||
276 | |||
277 | /** | ||
272 | * Block options for the file. | 278 | * Block options for the file. |
273 | */ | 279 | */ |
274 | struct GNUNET_FS_BlockOptions bo; | 280 | struct GNUNET_FS_BlockOptions bo; |
@@ -735,7 +741,7 @@ GNUNET_FS_search_probe_progress_ (void *cls, | |||
735 | /** | 741 | /** |
736 | * Main function that performs the upload. | 742 | * Main function that performs the upload. |
737 | * | 743 | * |
738 | * @param cls "struct GNUNET_FS_PublishContext" identifies the upload | 744 | * @param cls `struct GNUNET_FS_PublishContext` identifies the upload |
739 | * @param tc task context | 745 | * @param tc task context |
740 | */ | 746 | */ |
741 | void | 747 | void |
diff --git a/src/fs/fs_file_information.c b/src/fs/fs_file_information.c index d369598ef..f004e4b29 100644 --- a/src/fs/fs_file_information.c +++ b/src/fs/fs_file_information.c | |||
@@ -436,7 +436,10 @@ GNUNET_FS_file_information_destroy (struct GNUNET_FS_FileInformation *fi, | |||
436 | } | 436 | } |
437 | GNUNET_free_non_null (fi->filename); | 437 | GNUNET_free_non_null (fi->filename); |
438 | GNUNET_free_non_null (fi->emsg); | 438 | GNUNET_free_non_null (fi->emsg); |
439 | GNUNET_free_non_null (fi->chk_uri); | 439 | if (NULL != fi->sks_uri) |
440 | GNUNET_FS_uri_destroy (fi->sks_uri); | ||
441 | if (NULL != fi->chk_uri) | ||
442 | GNUNET_FS_uri_destroy (fi->chk_uri); | ||
440 | /* clean up serialization */ | 443 | /* clean up serialization */ |
441 | if ((NULL != fi->serialization) && (0 != UNLINK (fi->serialization))) | 444 | if ((NULL != fi->serialization) && (0 != UNLINK (fi->serialization))) |
442 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "unlink", | 445 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "unlink", |
diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c index 2075c5f2b..c9e2b0e6a 100644 --- a/src/fs/fs_publish.c +++ b/src/fs/fs_publish.c | |||
@@ -17,7 +17,6 @@ | |||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | |||
21 | /** | 20 | /** |
22 | * @file fs/fs_publish.c | 21 | * @file fs/fs_publish.c |
23 | * @brief publish a file or directory in GNUnet | 22 | * @brief publish a file or directory in GNUnet |
@@ -25,7 +24,6 @@ | |||
25 | * @author Krista Bennett | 24 | * @author Krista Bennett |
26 | * @author Christian Grothoff | 25 | * @author Christian Grothoff |
27 | */ | 26 | */ |
28 | |||
29 | #include "platform.h" | 27 | #include "platform.h" |
30 | #include "gnunet_constants.h" | 28 | #include "gnunet_constants.h" |
31 | #include "gnunet_signatures.h" | 29 | #include "gnunet_signatures.h" |
@@ -57,9 +55,10 @@ GNUNET_FS_publish_make_status_ (struct GNUNET_FS_ProgressInfo *pi, | |||
57 | pi->value.publish.pctx = (NULL == p->dir) ? NULL : p->dir->client_info; | 55 | pi->value.publish.pctx = (NULL == p->dir) ? NULL : p->dir->client_info; |
58 | pi->value.publish.filename = p->filename; | 56 | pi->value.publish.filename = p->filename; |
59 | pi->value.publish.size = | 57 | pi->value.publish.size = |
60 | (p->is_directory == GNUNET_YES) ? p->data.dir.dir_size : p->data.file.file_size; | 58 | (GNUNET_YES == p->is_directory) ? p->data.dir.dir_size : p->data.file.file_size; |
61 | pi->value.publish.eta = | 59 | pi->value.publish.eta = |
62 | GNUNET_TIME_calculate_eta (p->start_time, offset, pi->value.publish.size); | 60 | GNUNET_TIME_calculate_eta (p->start_time, offset, |
61 | pi->value.publish.size); | ||
63 | pi->value.publish.completed = offset; | 62 | pi->value.publish.completed = offset; |
64 | pi->value.publish.duration = | 63 | pi->value.publish.duration = |
65 | GNUNET_TIME_absolute_get_duration (p->start_time); | 64 | GNUNET_TIME_absolute_get_duration (p->start_time); |
@@ -77,8 +76,9 @@ GNUNET_FS_publish_make_status_ (struct GNUNET_FS_ProgressInfo *pi, | |||
77 | static void | 76 | static void |
78 | publish_cleanup (struct GNUNET_FS_PublishContext *pc) | 77 | publish_cleanup (struct GNUNET_FS_PublishContext *pc) |
79 | { | 78 | { |
80 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up publish context (done!)\n"); | 79 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
81 | if (pc->fhc != NULL) | 80 | "Cleaning up publish context (done!)\n"); |
81 | if (NULL != pc->fhc) | ||
82 | { | 82 | { |
83 | GNUNET_CRYPTO_hash_file_cancel (pc->fhc); | 83 | GNUNET_CRYPTO_hash_file_cancel (pc->fhc); |
84 | pc->fhc = NULL; | 84 | pc->fhc = NULL; |
@@ -87,12 +87,12 @@ publish_cleanup (struct GNUNET_FS_PublishContext *pc) | |||
87 | GNUNET_free_non_null (pc->nid); | 87 | GNUNET_free_non_null (pc->nid); |
88 | GNUNET_free_non_null (pc->nuid); | 88 | GNUNET_free_non_null (pc->nuid); |
89 | GNUNET_free_non_null (pc->serialization); | 89 | GNUNET_free_non_null (pc->serialization); |
90 | if (pc->dsh != NULL) | 90 | if (NULL != pc->dsh) |
91 | { | 91 | { |
92 | GNUNET_DATASTORE_disconnect (pc->dsh, GNUNET_NO); | 92 | GNUNET_DATASTORE_disconnect (pc->dsh, GNUNET_NO); |
93 | pc->dsh = NULL; | 93 | pc->dsh = NULL; |
94 | } | 94 | } |
95 | if (pc->client != NULL) | 95 | if (NULL != pc->client) |
96 | { | 96 | { |
97 | GNUNET_CLIENT_disconnect (pc->client); | 97 | GNUNET_CLIENT_disconnect (pc->client); |
98 | pc->client = NULL; | 98 | pc->client = NULL; |
@@ -122,7 +122,9 @@ ds_put_cont (void *cls, int success, | |||
122 | pc->qre = NULL; | 122 | pc->qre = NULL; |
123 | if (GNUNET_SYSERR == success) | 123 | if (GNUNET_SYSERR == success) |
124 | { | 124 | { |
125 | GNUNET_asprintf (&pc->fi_pos->emsg, _("Publishing failed: %s"), msg); | 125 | GNUNET_asprintf (&pc->fi_pos->emsg, |
126 | _("Publishing failed: %s"), | ||
127 | msg); | ||
126 | pi.status = GNUNET_FS_STATUS_PUBLISH_ERROR; | 128 | pi.status = GNUNET_FS_STATUS_PUBLISH_ERROR; |
127 | pi.value.publish.eta = GNUNET_TIME_UNIT_FOREVER_REL; | 129 | pi.value.publish.eta = GNUNET_TIME_UNIT_FOREVER_REL; |
128 | pi.value.publish.specifics.error.message = pc->fi_pos->emsg; | 130 | pi.value.publish.specifics.error.message = pc->fi_pos->emsg; |
@@ -160,10 +162,10 @@ signal_publish_completion (struct GNUNET_FS_FileInformation *p, | |||
160 | pi.status = GNUNET_FS_STATUS_PUBLISH_COMPLETED; | 162 | pi.status = GNUNET_FS_STATUS_PUBLISH_COMPLETED; |
161 | pi.value.publish.eta = GNUNET_TIME_UNIT_ZERO; | 163 | pi.value.publish.eta = GNUNET_TIME_UNIT_ZERO; |
162 | pi.value.publish.specifics.completed.chk_uri = p->chk_uri; | 164 | pi.value.publish.specifics.completed.chk_uri = p->chk_uri; |
165 | pi.value.publish.specifics.completed.sks_uri = p->sks_uri; | ||
163 | p->client_info = | 166 | p->client_info = |
164 | GNUNET_FS_publish_make_status_ (&pi, pc, p, | 167 | GNUNET_FS_publish_make_status_ (&pi, pc, p, |
165 | GNUNET_ntohll (p->chk_uri->data. | 168 | p->data.file.file_size); |
166 | chk.file_length)); | ||
167 | } | 169 | } |
168 | 170 | ||
169 | 171 | ||
@@ -178,7 +180,8 @@ signal_publish_completion (struct GNUNET_FS_FileInformation *p, | |||
178 | */ | 180 | */ |
179 | static void | 181 | static void |
180 | signal_publish_error (struct GNUNET_FS_FileInformation *p, | 182 | signal_publish_error (struct GNUNET_FS_FileInformation *p, |
181 | struct GNUNET_FS_PublishContext *pc, const char *emsg) | 183 | struct GNUNET_FS_PublishContext *pc, |
184 | const char *emsg) | ||
182 | { | 185 | { |
183 | struct GNUNET_FS_ProgressInfo pi; | 186 | struct GNUNET_FS_ProgressInfo pi; |
184 | 187 | ||
@@ -225,12 +228,13 @@ finish_release_reserve (void *cls, int success, | |||
225 | * We've finished publishing the SBlock as part of a larger upload. | 228 | * We've finished publishing the SBlock as part of a larger upload. |
226 | * Check the result and complete the larger upload. | 229 | * Check the result and complete the larger upload. |
227 | * | 230 | * |
228 | * @param cls the "struct GNUNET_FS_PublishContext*" of the larger upload | 231 | * @param cls the `struct GNUNET_FS_PublishContext *` of the larger upload |
229 | * @param uri URI of the published SBlock | 232 | * @param uri URI of the published SBlock |
230 | * @param emsg NULL on success, otherwise error message | 233 | * @param emsg NULL on success, otherwise error message |
231 | */ | 234 | */ |
232 | static void | 235 | static void |
233 | publish_sblocks_cont (void *cls, const struct GNUNET_FS_Uri *uri, | 236 | publish_sblocks_cont (void *cls, |
237 | const struct GNUNET_FS_Uri *uri, | ||
234 | const char *emsg) | 238 | const char *emsg) |
235 | { | 239 | { |
236 | struct GNUNET_FS_PublishContext *pc = cls; | 240 | struct GNUNET_FS_PublishContext *pc = cls; |
@@ -242,6 +246,11 @@ publish_sblocks_cont (void *cls, const struct GNUNET_FS_Uri *uri, | |||
242 | GNUNET_FS_publish_sync_ (pc); | 246 | GNUNET_FS_publish_sync_ (pc); |
243 | return; | 247 | return; |
244 | } | 248 | } |
249 | if (NULL != uri) | ||
250 | { | ||
251 | /* sks publication, remember namespace URI */ | ||
252 | pc->fi->sks_uri = GNUNET_FS_uri_dup (uri); | ||
253 | } | ||
245 | GNUNET_assert (pc->qre == NULL); | 254 | GNUNET_assert (pc->qre == NULL); |
246 | if ((pc->dsh != NULL) && (pc->rid != 0)) | 255 | if ((pc->dsh != NULL) && (pc->rid != 0)) |
247 | { | 256 | { |
@@ -291,7 +300,8 @@ publish_sblock (struct GNUNET_FS_PublishContext *pc) | |||
291 | * @param emsg NULL on success, otherwise error message | 300 | * @param emsg NULL on success, otherwise error message |
292 | */ | 301 | */ |
293 | static void | 302 | static void |
294 | publish_kblocks_cont (void *cls, const struct GNUNET_FS_Uri *uri, | 303 | publish_kblocks_cont (void *cls, |
304 | const struct GNUNET_FS_Uri *uri, | ||
295 | const char *emsg) | 305 | const char *emsg) |
296 | { | 306 | { |
297 | struct GNUNET_FS_PublishContext *pc = cls; | 307 | struct GNUNET_FS_PublishContext *pc = cls; |
@@ -309,7 +319,9 @@ publish_kblocks_cont (void *cls, const struct GNUNET_FS_Uri *uri, | |||
309 | GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == pc->upload_task); | 319 | GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == pc->upload_task); |
310 | pc->upload_task = | 320 | pc->upload_task = |
311 | GNUNET_SCHEDULER_add_with_priority | 321 | GNUNET_SCHEDULER_add_with_priority |
312 | (GNUNET_SCHEDULER_PRIORITY_BACKGROUND, &GNUNET_FS_publish_main_, pc); | 322 | (GNUNET_SCHEDULER_PRIORITY_BACKGROUND, |
323 | &GNUNET_FS_publish_main_, | ||
324 | pc); | ||
313 | return; | 325 | return; |
314 | } | 326 | } |
315 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 327 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -343,7 +355,11 @@ publish_kblocks_cont (void *cls, const struct GNUNET_FS_Uri *uri, | |||
343 | * @return number of bytes copied to buf, 0 on error | 355 | * @return number of bytes copied to buf, 0 on error |
344 | */ | 356 | */ |
345 | static size_t | 357 | static size_t |
346 | block_reader (void *cls, uint64_t offset, size_t max, void *buf, char **emsg) | 358 | block_reader (void *cls, |
359 | uint64_t offset, | ||
360 | size_t max, | ||
361 | void *buf, | ||
362 | char **emsg) | ||
347 | { | 363 | { |
348 | struct GNUNET_FS_PublishContext *pc = cls; | 364 | struct GNUNET_FS_PublishContext *pc = cls; |
349 | struct GNUNET_FS_FileInformation *p; | 365 | struct GNUNET_FS_FileInformation *p; |
@@ -884,9 +900,9 @@ GNUNET_FS_publish_main_ (void *cls, | |||
884 | if (0 == p->bo.anonymity_level) | 900 | if (0 == p->bo.anonymity_level) |
885 | { | 901 | { |
886 | /* zero anonymity, box CHK URI in LOC URI */ | 902 | /* zero anonymity, box CHK URI in LOC URI */ |
887 | loc = | 903 | loc = GNUNET_FS_uri_loc_create (p->chk_uri, |
888 | GNUNET_FS_uri_loc_create (p->chk_uri, pc->h->cfg, | 904 | pc->h->cfg, |
889 | p->bo.expiration_time); | 905 | p->bo.expiration_time); |
890 | GNUNET_FS_uri_destroy (p->chk_uri); | 906 | GNUNET_FS_uri_destroy (p->chk_uri); |
891 | p->chk_uri = loc; | 907 | p->chk_uri = loc; |
892 | GNUNET_FS_file_information_sync_ (p); | 908 | GNUNET_FS_file_information_sync_ (p); |
@@ -895,8 +911,13 @@ GNUNET_FS_publish_main_ (void *cls, | |||
895 | /* upload of "p" complete, publish KBlocks! */ | 911 | /* upload of "p" complete, publish KBlocks! */ |
896 | if (NULL != p->keywords) | 912 | if (NULL != p->keywords) |
897 | { | 913 | { |
898 | pc->ksk_pc = GNUNET_FS_publish_ksk (pc->h, p->keywords, p->meta, p->chk_uri, &p->bo, | 914 | pc->ksk_pc = GNUNET_FS_publish_ksk (pc->h, |
899 | pc->options, &publish_kblocks_cont, pc); | 915 | p->keywords, |
916 | p->meta, | ||
917 | p->chk_uri, | ||
918 | &p->bo, | ||
919 | pc->options, | ||
920 | &publish_kblocks_cont, pc); | ||
900 | } | 921 | } |
901 | else | 922 | else |
902 | { | 923 | { |
@@ -910,9 +931,9 @@ GNUNET_FS_publish_main_ (void *cls, | |||
910 | { | 931 | { |
911 | p->data.file.do_index = GNUNET_NO; | 932 | p->data.file.do_index = GNUNET_NO; |
912 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 933 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
913 | _ | 934 | _("Can not index file `%s': %s. Will try to insert instead.\n"), |
914 | ("Can not index file `%s': %s. Will try to insert instead.\n"), | 935 | "<no-name>", |
915 | "<no-name>", _("needs to be an actual file")); | 936 | _("needs to be an actual file")); |
916 | GNUNET_FS_file_information_sync_ (p); | 937 | GNUNET_FS_file_information_sync_ (p); |
917 | publish_content (pc); | 938 | publish_content (pc); |
918 | return; | 939 | return; |
@@ -1239,14 +1260,15 @@ GNUNET_FS_publish_start (struct GNUNET_FS_Handle *h, | |||
1239 | { | 1260 | { |
1240 | GNUNET_assert (NULL == ret->qre); | 1261 | GNUNET_assert (NULL == ret->qre); |
1241 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1262 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
1242 | _ | 1263 | _("Reserving space for %u entries and %llu bytes for publication\n"), |
1243 | ("Reserving space for %u entries and %llu bytes for publication\n"), | ||
1244 | (unsigned int) ret->reserve_entries, | 1264 | (unsigned int) ret->reserve_entries, |
1245 | (unsigned long long) ret->reserve_space); | 1265 | (unsigned long long) ret->reserve_space); |
1246 | ret->qre = | 1266 | ret->qre = |
1247 | GNUNET_DATASTORE_reserve (ret->dsh, ret->reserve_space, | 1267 | GNUNET_DATASTORE_reserve (ret->dsh, ret->reserve_space, |
1248 | ret->reserve_entries, UINT_MAX, UINT_MAX, | 1268 | ret->reserve_entries, |
1249 | GNUNET_TIME_UNIT_FOREVER_REL, &finish_reserve, | 1269 | UINT_MAX, UINT_MAX, |
1270 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
1271 | &finish_reserve, | ||
1250 | ret); | 1272 | ret); |
1251 | } | 1273 | } |
1252 | else | 1274 | else |
@@ -1275,9 +1297,12 @@ GNUNET_FS_publish_start (struct GNUNET_FS_Handle *h, | |||
1275 | * @return #GNUNET_OK to continue (always) | 1297 | * @return #GNUNET_OK to continue (always) |
1276 | */ | 1298 | */ |
1277 | static int | 1299 | static int |
1278 | fip_signal_stop (void *cls, struct GNUNET_FS_FileInformation *fi, | 1300 | fip_signal_stop (void *cls, |
1279 | uint64_t length, struct GNUNET_CONTAINER_MetaData *meta, | 1301 | struct GNUNET_FS_FileInformation *fi, |
1280 | struct GNUNET_FS_Uri **uri, struct GNUNET_FS_BlockOptions *bo, | 1302 | uint64_t length, |
1303 | struct GNUNET_CONTAINER_MetaData *meta, | ||
1304 | struct GNUNET_FS_Uri **uri, | ||
1305 | struct GNUNET_FS_BlockOptions *bo, | ||
1281 | int *do_index, void **client_info) | 1306 | int *do_index, void **client_info) |
1282 | { | 1307 | { |
1283 | struct GNUNET_FS_PublishContext *pc = cls; | 1308 | struct GNUNET_FS_PublishContext *pc = cls; |
@@ -1324,7 +1349,8 @@ GNUNET_FS_publish_stop (struct GNUNET_FS_PublishContext *pc) | |||
1324 | struct GNUNET_FS_ProgressInfo pi; | 1349 | struct GNUNET_FS_ProgressInfo pi; |
1325 | uint64_t off; | 1350 | uint64_t off; |
1326 | 1351 | ||
1327 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Publish stop called\n"); | 1352 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1353 | "Publish stop called\n"); | ||
1328 | GNUNET_FS_end_top (pc->h, pc->top); | 1354 | GNUNET_FS_end_top (pc->h, pc->top); |
1329 | if (NULL != pc->ksk_pc) | 1355 | if (NULL != pc->ksk_pc) |
1330 | { | 1356 | { |
@@ -1344,16 +1370,19 @@ GNUNET_FS_publish_stop (struct GNUNET_FS_PublishContext *pc) | |||
1344 | pc->skip_next_fi_callback = GNUNET_YES; | 1370 | pc->skip_next_fi_callback = GNUNET_YES; |
1345 | GNUNET_FS_file_information_inspect (pc->fi, &fip_signal_stop, pc); | 1371 | GNUNET_FS_file_information_inspect (pc->fi, &fip_signal_stop, pc); |
1346 | 1372 | ||
1347 | if (pc->fi->serialization != NULL) | 1373 | if (NULL != pc->fi->serialization) |
1348 | { | 1374 | { |
1349 | GNUNET_FS_remove_sync_file_ (pc->h, GNUNET_FS_SYNC_PATH_FILE_INFO, | 1375 | GNUNET_FS_remove_sync_file_ (pc->h, GNUNET_FS_SYNC_PATH_FILE_INFO, |
1350 | pc->fi->serialization); | 1376 | pc->fi->serialization); |
1351 | GNUNET_free (pc->fi->serialization); | 1377 | GNUNET_free (pc->fi->serialization); |
1352 | pc->fi->serialization = NULL; | 1378 | pc->fi->serialization = NULL; |
1353 | } | 1379 | } |
1354 | off = (pc->fi->chk_uri == NULL) ? 0 : GNUNET_ntohll (pc->fi->chk_uri->data.chk.file_length); | 1380 | if (NULL == pc->fi->chk_uri) |
1381 | off = 0; /* won't be completed anymore */ | ||
1382 | else | ||
1383 | off = pc->fi->is_directory ? pc->fi->data.dir.contents_completed : pc->fi->data.file.file_size; /* we were done */ | ||
1355 | 1384 | ||
1356 | if (pc->serialization != NULL) | 1385 | if (NULL != pc->serialization) |
1357 | { | 1386 | { |
1358 | GNUNET_FS_remove_sync_file_ (pc->h, GNUNET_FS_SYNC_PATH_MASTER_PUBLISH, | 1387 | GNUNET_FS_remove_sync_file_ (pc->h, GNUNET_FS_SYNC_PATH_MASTER_PUBLISH, |
1359 | pc->serialization); | 1388 | pc->serialization); |
@@ -1371,5 +1400,4 @@ GNUNET_FS_publish_stop (struct GNUNET_FS_PublishContext *pc) | |||
1371 | } | 1400 | } |
1372 | 1401 | ||
1373 | 1402 | ||
1374 | |||
1375 | /* end of fs_publish.c */ | 1403 | /* end of fs_publish.c */ |
diff --git a/src/fs/gnunet-publish.c b/src/fs/gnunet-publish.c index f192a0a90..f8396416c 100644 --- a/src/fs/gnunet-publish.c +++ b/src/fs/gnunet-publish.c | |||
@@ -154,11 +154,17 @@ static struct GNUNET_IDENTITY_Handle *identity; | |||
154 | * @param tc scheduler context | 154 | * @param tc scheduler context |
155 | */ | 155 | */ |
156 | static void | 156 | static void |
157 | do_stop_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 157 | do_stop_task (void *cls, |
158 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
158 | { | 159 | { |
159 | struct GNUNET_FS_PublishContext *p; | 160 | struct GNUNET_FS_PublishContext *p; |
160 | 161 | ||
161 | kill_task = GNUNET_SCHEDULER_NO_TASK; | 162 | kill_task = GNUNET_SCHEDULER_NO_TASK; |
163 | if (NULL != identity) | ||
164 | { | ||
165 | GNUNET_IDENTITY_disconnect (identity); | ||
166 | identity = NULL; | ||
167 | } | ||
162 | if (NULL != pc) | 168 | if (NULL != pc) |
163 | { | 169 | { |
164 | p = pc; | 170 | p = pc; |
@@ -213,7 +219,8 @@ stop_scanner_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
213 | * field in the GNUNET_FS_ProgressInfo struct. | 219 | * field in the GNUNET_FS_ProgressInfo struct. |
214 | */ | 220 | */ |
215 | static void * | 221 | static void * |
216 | progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info) | 222 | progress_cb (void *cls, |
223 | const struct GNUNET_FS_ProgressInfo *info) | ||
217 | { | 224 | { |
218 | const char *s; | 225 | const char *s; |
219 | char *suri; | 226 | char *suri; |
@@ -257,19 +264,28 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info) | |||
257 | kill_task = GNUNET_SCHEDULER_add_now (&do_stop_task, NULL); | 264 | kill_task = GNUNET_SCHEDULER_add_now (&do_stop_task, NULL); |
258 | break; | 265 | break; |
259 | case GNUNET_FS_STATUS_PUBLISH_COMPLETED: | 266 | case GNUNET_FS_STATUS_PUBLISH_COMPLETED: |
260 | FPRINTF (stdout, _("Publishing `%s' done.\n"), | 267 | FPRINTF (stdout, |
268 | _("Publishing `%s' done.\n"), | ||
261 | info->value.publish.filename); | 269 | info->value.publish.filename); |
262 | suri = GNUNET_FS_uri_to_string (info->value.publish.specifics. | 270 | suri = GNUNET_FS_uri_to_string (info->value.publish.specifics. |
263 | completed.chk_uri); | 271 | completed.chk_uri); |
264 | FPRINTF (stdout, _("URI is `%s'.\n"), suri); | 272 | FPRINTF (stdout, |
273 | _("URI is `%s'.\n"), | ||
274 | suri); | ||
265 | GNUNET_free (suri); | 275 | GNUNET_free (suri); |
276 | if (NULL != info->value.publish.specifics.completed.sks_uri) | ||
277 | { | ||
278 | suri = GNUNET_FS_uri_to_string (info->value.publish.specifics. | ||
279 | completed.sks_uri); | ||
280 | FPRINTF (stdout, | ||
281 | _("Namespace URI is `%s'.\n"), | ||
282 | suri); | ||
283 | GNUNET_free (suri); | ||
284 | } | ||
266 | if (NULL == info->value.publish.pctx) | 285 | if (NULL == info->value.publish.pctx) |
267 | { | 286 | { |
268 | if (GNUNET_SCHEDULER_NO_TASK != kill_task) | 287 | if (GNUNET_SCHEDULER_NO_TASK != kill_task) |
269 | { | ||
270 | GNUNET_SCHEDULER_cancel (kill_task); | 288 | GNUNET_SCHEDULER_cancel (kill_task); |
271 | kill_task = GNUNET_SCHEDULER_NO_TASK; | ||
272 | } | ||
273 | kill_task = GNUNET_SCHEDULER_add_now (&do_stop_task, NULL); | 289 | kill_task = GNUNET_SCHEDULER_add_now (&do_stop_task, NULL); |
274 | } | 290 | } |
275 | ret = 0; | 291 | ret = 0; |
@@ -280,7 +296,9 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info) | |||
280 | case GNUNET_FS_STATUS_UNINDEX_PROGRESS: | 296 | case GNUNET_FS_STATUS_UNINDEX_PROGRESS: |
281 | return NULL; | 297 | return NULL; |
282 | case GNUNET_FS_STATUS_UNINDEX_COMPLETED: | 298 | case GNUNET_FS_STATUS_UNINDEX_COMPLETED: |
283 | FPRINTF (stderr, "%s", _("Cleanup after abort complete.\n")); | 299 | FPRINTF (stderr, |
300 | "%s", | ||
301 | _("Cleanup after abort complete.\n")); | ||
284 | return NULL; | 302 | return NULL; |
285 | default: | 303 | default: |
286 | FPRINTF (stderr, _("Unexpected status: %d\n"), info->status); | 304 | FPRINTF (stderr, _("Unexpected status: %d\n"), info->status); |
@@ -300,12 +318,15 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info) | |||
300 | * @param format format of data | 318 | * @param format format of data |
301 | * @param data_mime_type mime type of data | 319 | * @param data_mime_type mime type of data |
302 | * @param data value of the meta data | 320 | * @param data value of the meta data |
303 | * @param data_size number of bytes in data | 321 | * @param data_size number of bytes in @a data |
304 | * @return always 0 | 322 | * @return always 0 |
305 | */ | 323 | */ |
306 | static int | 324 | static int |
307 | meta_printer (void *cls, const char *plugin_name, enum EXTRACTOR_MetaType type, | 325 | meta_printer (void *cls, |
308 | enum EXTRACTOR_MetaFormat format, const char *data_mime_type, | 326 | const char *plugin_name, |
327 | enum EXTRACTOR_MetaType type, | ||
328 | enum EXTRACTOR_MetaFormat format, | ||
329 | const char *data_mime_type, | ||
309 | const char *data, size_t data_size) | 330 | const char *data, size_t data_size) |
310 | { | 331 | { |
311 | if ((EXTRACTOR_METAFORMAT_UTF8 != format) && | 332 | if ((EXTRACTOR_METAFORMAT_UTF8 != format) && |
@@ -324,10 +345,12 @@ meta_printer (void *cls, const char *plugin_name, enum EXTRACTOR_MetaType type, | |||
324 | * @param cls closure | 345 | * @param cls closure |
325 | * @param keyword the keyword | 346 | * @param keyword the keyword |
326 | * @param is_mandatory is the keyword mandatory (in a search) | 347 | * @param is_mandatory is the keyword mandatory (in a search) |
327 | * @return GNUNET_OK to continue to iterate, GNUNET_SYSERR to abort | 348 | * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to abort |
328 | */ | 349 | */ |
329 | static int | 350 | static int |
330 | keyword_printer (void *cls, const char *keyword, int is_mandatory) | 351 | keyword_printer (void *cls, |
352 | const char *keyword, | ||
353 | int is_mandatory) | ||
331 | { | 354 | { |
332 | FPRINTF (stdout, "\t%s\n", keyword); | 355 | FPRINTF (stdout, "\t%s\n", keyword); |
333 | return GNUNET_OK; | 356 | return GNUNET_OK; |
@@ -347,15 +370,18 @@ keyword_printer (void *cls, const char *keyword, int is_mandatory) | |||
347 | * @param bo block options | 370 | * @param bo block options |
348 | * @param do_index should we index? | 371 | * @param do_index should we index? |
349 | * @param client_info pointer to client context set upon creation (can be modified) | 372 | * @param client_info pointer to client context set upon creation (can be modified) |
350 | * @return GNUNET_OK to continue, GNUNET_NO to remove | 373 | * @return #GNUNET_OK to continue, #GNUNET_NO to remove |
351 | * this entry from the directory, GNUNET_SYSERR | 374 | * this entry from the directory, #GNUNET_SYSERR |
352 | * to abort the iteration | 375 | * to abort the iteration |
353 | */ | 376 | */ |
354 | static int | 377 | static int |
355 | publish_inspector (void *cls, struct GNUNET_FS_FileInformation *fi, | 378 | publish_inspector (void *cls, |
356 | uint64_t length, struct GNUNET_CONTAINER_MetaData *m, | 379 | struct GNUNET_FS_FileInformation *fi, |
380 | uint64_t length, | ||
381 | struct GNUNET_CONTAINER_MetaData *m, | ||
357 | struct GNUNET_FS_Uri **uri, | 382 | struct GNUNET_FS_Uri **uri, |
358 | struct GNUNET_FS_BlockOptions *bo, int *do_index, | 383 | struct GNUNET_FS_BlockOptions *bo, |
384 | int *do_index, | ||
359 | void **client_info) | 385 | void **client_info) |
360 | { | 386 | { |
361 | char *fn; | 387 | char *fn; |
@@ -423,7 +449,8 @@ publish_inspector (void *cls, struct GNUNET_FS_FileInformation *fi, | |||
423 | * @param emsg error message, NULL on success | 449 | * @param emsg error message, NULL on success |
424 | */ | 450 | */ |
425 | static void | 451 | static void |
426 | uri_sks_continuation (void *cls, const struct GNUNET_FS_Uri *sks_uri, | 452 | uri_sks_continuation (void *cls, |
453 | const struct GNUNET_FS_Uri *sks_uri, | ||
427 | const char *emsg) | 454 | const char *emsg) |
428 | { | 455 | { |
429 | if (NULL != emsg) | 456 | if (NULL != emsg) |
@@ -540,7 +567,9 @@ directory_trim_complete (struct GNUNET_FS_ShareTreeItem *directory_scan_result) | |||
540 | GNUNET_FS_share_tree_free (directory_scan_result); | 567 | GNUNET_FS_share_tree_free (directory_scan_result); |
541 | if (NULL == fi) | 568 | if (NULL == fi) |
542 | { | 569 | { |
543 | FPRINTF (stderr, "%s", _("Could not publish\n")); | 570 | FPRINTF (stderr, |
571 | "%s", | ||
572 | _("Could not publish\n")); | ||
544 | GNUNET_SCHEDULER_shutdown (); | 573 | GNUNET_SCHEDULER_shutdown (); |
545 | ret = 1; | 574 | ret = 1; |
546 | return; | 575 | return; |
@@ -563,7 +592,9 @@ directory_trim_complete (struct GNUNET_FS_ShareTreeItem *directory_scan_result) | |||
563 | GNUNET_FS_PUBLISH_OPTION_NONE); | 592 | GNUNET_FS_PUBLISH_OPTION_NONE); |
564 | if (NULL == pc) | 593 | if (NULL == pc) |
565 | { | 594 | { |
566 | FPRINTF (stderr, "%s", _("Could not start publishing.\n")); | 595 | FPRINTF (stderr, |
596 | "%s", | ||
597 | _("Could not start publishing.\n")); | ||
567 | GNUNET_SCHEDULER_shutdown (); | 598 | GNUNET_SCHEDULER_shutdown (); |
568 | ret = 1; | 599 | ret = 1; |
569 | return; | 600 | return; |
@@ -577,9 +608,9 @@ directory_trim_complete (struct GNUNET_FS_ShareTreeItem *directory_scan_result) | |||
577 | * | 608 | * |
578 | * @param cls closure | 609 | * @param cls closure |
579 | * @param filename which file we are making progress on | 610 | * @param filename which file we are making progress on |
580 | * @param is_directory GNUNET_YES if this is a directory, | 611 | * @param is_directory #GNUNET_YES if this is a directory, |
581 | * GNUNET_NO if this is a file | 612 | * #GNUNET_NO if this is a file |
582 | * GNUNET_SYSERR if it is neither (or unknown) | 613 | * #GNUNET_SYSERR if it is neither (or unknown) |
583 | * @param reason kind of progress we are making | 614 | * @param reason kind of progress we are making |
584 | */ | 615 | */ |
585 | static void | 616 | static void |
@@ -596,9 +627,13 @@ directory_scan_cb (void *cls, | |||
596 | if (verbose > 1) | 627 | if (verbose > 1) |
597 | { | 628 | { |
598 | if (is_directory == GNUNET_YES) | 629 | if (is_directory == GNUNET_YES) |
599 | FPRINTF (stdout, _("Scanning directory `%s'.\n"), filename); | 630 | FPRINTF (stdout, |
631 | _("Scanning directory `%s'.\n"), | ||
632 | filename); | ||
600 | else | 633 | else |
601 | FPRINTF (stdout, _("Scanning file `%s'.\n"), filename); | 634 | FPRINTF (stdout, |
635 | _("Scanning file `%s'.\n"), | ||
636 | filename); | ||
602 | } | 637 | } |
603 | break; | 638 | break; |
604 | case GNUNET_FS_DIRSCANNER_FILE_IGNORED: | 639 | case GNUNET_FS_DIRSCANNER_FILE_IGNORED: |
@@ -608,22 +643,30 @@ directory_scan_cb (void *cls, | |||
608 | break; | 643 | break; |
609 | case GNUNET_FS_DIRSCANNER_ALL_COUNTED: | 644 | case GNUNET_FS_DIRSCANNER_ALL_COUNTED: |
610 | if (verbose) | 645 | if (verbose) |
611 | FPRINTF (stdout, "%s", _("Preprocessing complete.\n")); | 646 | FPRINTF (stdout, |
647 | "%s", | ||
648 | _("Preprocessing complete.\n")); | ||
612 | break; | 649 | break; |
613 | case GNUNET_FS_DIRSCANNER_EXTRACT_FINISHED: | 650 | case GNUNET_FS_DIRSCANNER_EXTRACT_FINISHED: |
614 | if (verbose > 2) | 651 | if (verbose > 2) |
615 | FPRINTF (stdout, _("Extracting meta data from file `%s' complete.\n"), filename); | 652 | FPRINTF (stdout, |
653 | _("Extracting meta data from file `%s' complete.\n"), | ||
654 | filename); | ||
616 | break; | 655 | break; |
617 | case GNUNET_FS_DIRSCANNER_FINISHED: | 656 | case GNUNET_FS_DIRSCANNER_FINISHED: |
618 | if (verbose > 1) | 657 | if (verbose > 1) |
619 | FPRINTF (stdout, "%s", _("Meta data extraction has finished.\n")); | 658 | FPRINTF (stdout, |
659 | "%s", | ||
660 | _("Meta data extraction has finished.\n")); | ||
620 | directory_scan_result = GNUNET_FS_directory_scan_get_result (ds); | 661 | directory_scan_result = GNUNET_FS_directory_scan_get_result (ds); |
621 | ds = NULL; | 662 | ds = NULL; |
622 | GNUNET_FS_share_tree_trim (directory_scan_result); | 663 | GNUNET_FS_share_tree_trim (directory_scan_result); |
623 | directory_trim_complete (directory_scan_result); | 664 | directory_trim_complete (directory_scan_result); |
624 | break; | 665 | break; |
625 | case GNUNET_FS_DIRSCANNER_INTERNAL_ERROR: | 666 | case GNUNET_FS_DIRSCANNER_INTERNAL_ERROR: |
626 | FPRINTF (stdout, "%s", _("Internal error scanning directory.\n")); | 667 | FPRINTF (stdout, |
668 | "%s", | ||
669 | _("Internal error scanning directory.\n")); | ||
627 | if (kill_task != GNUNET_SCHEDULER_NO_TASK) | 670 | if (kill_task != GNUNET_SCHEDULER_NO_TASK) |
628 | { | 671 | { |
629 | GNUNET_SCHEDULER_cancel (kill_task); | 672 | GNUNET_SCHEDULER_cancel (kill_task); |
@@ -654,7 +697,9 @@ identity_continuation (const char *args0) | |||
654 | if ( (NULL != pseudonym) && | 697 | if ( (NULL != pseudonym) && |
655 | (NULL == namespace) ) | 698 | (NULL == namespace) ) |
656 | { | 699 | { |
657 | FPRINTF (stderr, _("Selected pseudonym `%s' unknown\n"), pseudonym); | 700 | FPRINTF (stderr, |
701 | _("Selected pseudonym `%s' unknown\n"), | ||
702 | pseudonym); | ||
658 | GNUNET_SCHEDULER_shutdown (); | 703 | GNUNET_SCHEDULER_shutdown (); |
659 | return; | 704 | return; |
660 | } | 705 | } |
@@ -663,14 +708,19 @@ identity_continuation (const char *args0) | |||
663 | emsg = NULL; | 708 | emsg = NULL; |
664 | if (NULL == (uri = GNUNET_FS_uri_parse (uri_string, &emsg))) | 709 | if (NULL == (uri = GNUNET_FS_uri_parse (uri_string, &emsg))) |
665 | { | 710 | { |
666 | FPRINTF (stderr, _("Failed to parse URI: %s\n"), emsg); | 711 | FPRINTF (stderr, |
712 | _("Failed to parse URI: %s\n"), | ||
713 | emsg); | ||
667 | GNUNET_free (emsg); | 714 | GNUNET_free (emsg); |
668 | GNUNET_SCHEDULER_shutdown (); | 715 | GNUNET_SCHEDULER_shutdown (); |
669 | ret = 1; | 716 | ret = 1; |
670 | return; | 717 | return; |
671 | } | 718 | } |
672 | GNUNET_FS_publish_ksk (ctx, topKeywords, meta, uri, &bo, | 719 | GNUNET_FS_publish_ksk (ctx, topKeywords, |
673 | GNUNET_FS_PUBLISH_OPTION_NONE, &uri_ksk_continuation, | 720 | meta, uri, |
721 | &bo, | ||
722 | GNUNET_FS_PUBLISH_OPTION_NONE, | ||
723 | &uri_ksk_continuation, | ||
674 | NULL); | 724 | NULL); |
675 | return; | 725 | return; |
676 | } | 726 | } |
@@ -693,7 +743,8 @@ identity_continuation (const char *args0) | |||
693 | if (NULL == ds) | 743 | if (NULL == ds) |
694 | { | 744 | { |
695 | FPRINTF (stderr, | 745 | FPRINTF (stderr, |
696 | "%s", _("Failed to start meta directory scanner. Is gnunet-helper-publish-fs installed?\n")); | 746 | "%s", |
747 | _("Failed to start meta directory scanner. Is gnunet-helper-publish-fs installed?\n")); | ||
697 | GNUNET_free_non_null (ex); | 748 | GNUNET_free_non_null (ex); |
698 | return; | 749 | return; |
699 | } | 750 | } |
@@ -725,6 +776,8 @@ identity_cb (void *cls, | |||
725 | identity_continuation (args0); | 776 | identity_continuation (args0); |
726 | return; | 777 | return; |
727 | } | 778 | } |
779 | if (NULL == name) | ||
780 | return; | ||
728 | if (0 == strcmp (name, pseudonym)) | 781 | if (0 == strcmp (name, pseudonym)) |
729 | namespace = ego; | 782 | namespace = ego; |
730 | } | 783 | } |
@@ -739,7 +792,9 @@ identity_cb (void *cls, | |||
739 | * @param c configuration | 792 | * @param c configuration |
740 | */ | 793 | */ |
741 | static void | 794 | static void |
742 | run (void *cls, char *const *args, const char *cfgfile, | 795 | run (void *cls, |
796 | char *const *args, | ||
797 | const char *cfgfile, | ||
743 | const struct GNUNET_CONFIGURATION_Handle *c) | 798 | const struct GNUNET_CONFIGURATION_Handle *c) |
744 | { | 799 | { |
745 | /* check arguments */ | 800 | /* check arguments */ |
@@ -776,14 +831,16 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
776 | { /* ordinary insertion checks */ | 831 | { /* ordinary insertion checks */ |
777 | if (NULL != next_id) | 832 | if (NULL != next_id) |
778 | { | 833 | { |
779 | FPRINTF (stderr, _("Option `%s' makes no sense without option `%s'.\n"), | 834 | FPRINTF (stderr, |
835 | _("Option `%s' makes no sense without option `%s'.\n"), | ||
780 | "-N", "-P"); | 836 | "-N", "-P"); |
781 | ret = -1; | 837 | ret = -1; |
782 | return; | 838 | return; |
783 | } | 839 | } |
784 | if (NULL != this_id) | 840 | if (NULL != this_id) |
785 | { | 841 | { |
786 | FPRINTF (stderr, _("Option `%s' makes no sense without option `%s'.\n"), | 842 | FPRINTF (stderr, |
843 | _("Option `%s' makes no sense without option `%s'.\n"), | ||
787 | "-t", "-P"); | 844 | "-t", "-P"); |
788 | ret = -1; | 845 | ret = -1; |
789 | return; | 846 | return; |
@@ -795,16 +852,20 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
795 | GNUNET_FS_FLAGS_NONE, GNUNET_FS_OPTIONS_END); | 852 | GNUNET_FS_FLAGS_NONE, GNUNET_FS_OPTIONS_END); |
796 | if (NULL == ctx) | 853 | if (NULL == ctx) |
797 | { | 854 | { |
798 | FPRINTF (stderr, _("Could not initialize `%s' subsystem.\n"), "FS"); | 855 | FPRINTF (stderr, |
856 | _("Could not initialize `%s' subsystem.\n"), | ||
857 | "FS"); | ||
799 | ret = 1; | 858 | ret = 1; |
800 | return; | 859 | return; |
801 | } | 860 | } |
802 | kill_task = | 861 | kill_task = |
803 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &do_stop_task, | 862 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, |
804 | NULL); | 863 | &do_stop_task, |
864 | NULL); | ||
805 | if (NULL != pseudonym) | 865 | if (NULL != pseudonym) |
806 | identity = GNUNET_IDENTITY_connect (cfg, | 866 | identity = GNUNET_IDENTITY_connect (cfg, |
807 | &identity_cb, args[0]); | 867 | &identity_cb, |
868 | args[0]); | ||
808 | else | 869 | else |
809 | identity_continuation (args[0]); | 870 | identity_continuation (args[0]); |
810 | } | 871 | } |
diff --git a/src/fs/test_fs_uri.c b/src/fs/test_fs_uri.c index b9296bcb6..afc80ef71 100644 --- a/src/fs/test_fs_uri.c +++ b/src/fs/test_fs_uri.c | |||
@@ -181,7 +181,7 @@ testNamespace (int i) | |||
181 | if (NULL != | 181 | if (NULL != |
182 | (ret = | 182 | (ret = |
183 | GNUNET_FS_uri_parse | 183 | GNUNET_FS_uri_parse |
184 | ("gnunet://fs/sks/D1KJS9H2A82Q65VKQ0ML3RFU6U1D3V/test", &emsg))) | 184 | ("gnunet://fs/sks/XQHH4R288W26EBV369F6RCE0PJVJTX2Y74Q2FJPMPGA31HJX2JG/this", &emsg))) |
185 | { | 185 | { |
186 | GNUNET_FS_uri_destroy (ret); | 186 | GNUNET_FS_uri_destroy (ret); |
187 | GNUNET_assert (0); | 187 | GNUNET_assert (0); |
@@ -273,7 +273,7 @@ testFile (int i) | |||
273 | GNUNET_free (emsg); | 273 | GNUNET_free (emsg); |
274 | ret = | 274 | ret = |
275 | GNUNET_FS_uri_parse | 275 | GNUNET_FS_uri_parse |
276 | ("gnunet://fs/chk/C282GG70GKK41O4551011DO413KFBVTVMQG1OG30I0K4045N0G41HAPB82G680A02JRVVFO8URVRU2F159011DO41000000022RG820.RNVVVVOOLCLK065B5D04HTNVNSIB2AI022RG8200HSLK1CO1000ATQ98824DMA2032LIMG50CG0K057NVUVG200000H000004400000.42", | 276 | ("gnunet://fs/chk/4QZP479A9SKGFNMQ2ZBCYE71YV2QMTVGWTVPB6A10ASVCKXDHB05DKPSC7ZF6E9P9W1VE47394EQY7NXA47Q6R35M7P1MJPGP59D1Z8.D54QD1K5XCG5878T6YZ19AM60MQ6FC0YNVK7QY08KK0KM0FJJ3KQWYG112FN5T07KN7J0X35DF6WVBT9B8ZMZ3X2BXJ22X3KFQ6MV2G.42", |
277 | &emsg); | 277 | &emsg); |
278 | if (ret == NULL) | 278 | if (ret == NULL) |
279 | { | 279 | { |
@@ -299,7 +299,7 @@ testFile (int i) | |||
299 | uri = GNUNET_FS_uri_to_string (ret); | 299 | uri = GNUNET_FS_uri_to_string (ret); |
300 | if (0 != | 300 | if (0 != |
301 | strcmp (uri, | 301 | strcmp (uri, |
302 | "gnunet://fs/chk/C282GG70GKK41O4551011DO413KFBVTVMQG1OG30I0K4045N0G41HAPB82G680A02JRVVFO8URVRU2F159011DO41000000022RG820.RNVVVVOOLCLK065B5D04HTNVNSIB2AI022RG8200HSLK1CO1000ATQ98824DMA2032LIMG50CG0K057NVUVG200000H000004400000.42")) | 302 | "gnunet://fs/chk/4QZP479A9SKGFNMQ2ZBCYE71YV2QMTVGWTVPB6A10ASVCKXDHB05DKPSC7ZF6E9P9W1VE47394EQY7NXA47Q6R35M7P1MJPGP59D1Z8.D54QD1K5XCG5878T6YZ19AM60MQ6FC0YNVK7QY08KK0KM0FJJ3KQWYG112FN5T07KN7J0X35DF6WVBT9B8ZMZ3X2BXJ22X3KFQ6MV2G.42")) |
303 | { | 303 | { |
304 | GNUNET_free (uri); | 304 | GNUNET_free (uri); |
305 | GNUNET_FS_uri_destroy (ret); | 305 | GNUNET_FS_uri_destroy (ret); |