2 This file is part of GNUnet.
3 Copyright (C) 2003--2013 GNUnet e.V.
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
22 * @file fs/fs_unindex.c
23 * @author Krista Grothoff
24 * @author Christian Grothoff
25 * @brief Unindex file.
28 #include "gnunet_constants.h"
29 #include "gnunet_fs_service.h"
30 #include "gnunet_protocols.h"
34 #include "fs_publish_ublock.h"
38 * Function called by the tree encoder to obtain
39 * a block of plaintext data (for the lowest level
42 * @param cls our publishing context
43 * @param offset identifies which block to get
44 * @param max (maximum) number of bytes to get; returning
45 * fewer will also cause errors
46 * @param buf where to copy the plaintext buffer
47 * @param emsg location to store an error message (on error)
48 * @return number of bytes copied to buf, 0 on error
51 unindex_reader (void *cls,
57 struct GNUNET_FS_UnindexContext *uc = cls;
60 pt_size = GNUNET_MIN (max, uc->file_size - offset);
61 if (offset != GNUNET_DISK_file_seek (uc->fh, offset, GNUNET_DISK_SEEK_SET))
63 *emsg = GNUNET_strdup (_("Failed to find given position in file"));
66 if (pt_size != GNUNET_DISK_file_read (uc->fh, buf, pt_size))
68 *emsg = GNUNET_strdup (_("Failed to read file"));
76 * Fill in all of the generic fields for
77 * an unindex event and call the callback.
79 * @param pi structure to fill in
80 * @param uc overall unindex context
81 * @param offset where we are in the file (for progress)
84 GNUNET_FS_unindex_make_status_ (struct GNUNET_FS_ProgressInfo *pi,
85 struct GNUNET_FS_UnindexContext *uc,
88 pi->value.unindex.uc = uc;
89 pi->value.unindex.cctx = uc->client_info;
90 pi->value.unindex.filename = uc->filename;
91 pi->value.unindex.size = uc->file_size;
92 pi->value.unindex.eta =
93 GNUNET_TIME_calculate_eta (uc->start_time, offset, uc->file_size);
94 pi->value.unindex.duration =
95 GNUNET_TIME_absolute_get_duration (uc->start_time);
96 pi->value.unindex.completed = offset;
98 uc->client_info = uc->h->upcb (uc->h->upcb_cls, pi);
103 * Function called with information about our
104 * progress in computing the tree encoding.
107 * @param offset where are we in the file
108 * @param pt_block plaintext of the currently processed block
109 * @param pt_size size of pt_block
110 * @param depth depth of the block in the tree, 0 for DBLOCK
113 unindex_progress (void *cls, uint64_t offset, const void *pt_block,
114 size_t pt_size, unsigned int depth)
116 struct GNUNET_FS_UnindexContext *uc = cls;
117 struct GNUNET_FS_ProgressInfo pi;
119 pi.status = GNUNET_FS_STATUS_UNINDEX_PROGRESS;
120 pi.value.unindex.specifics.progress.data = pt_block;
121 pi.value.unindex.specifics.progress.offset = offset;
122 pi.value.unindex.specifics.progress.data_len = pt_size;
123 pi.value.unindex.specifics.progress.depth = depth;
124 GNUNET_FS_unindex_make_status_ (&pi, uc, offset);
129 * We've encountered an error during
130 * unindexing. Signal the client.
132 * @param uc context for the failed unindexing operation
135 signal_unindex_error (struct GNUNET_FS_UnindexContext *uc)
137 struct GNUNET_FS_ProgressInfo pi;
139 pi.status = GNUNET_FS_STATUS_UNINDEX_ERROR;
140 pi.value.unindex.eta = GNUNET_TIME_UNIT_FOREVER_REL;
141 pi.value.unindex.specifics.error.message = uc->emsg;
142 GNUNET_FS_unindex_make_status_ (&pi, uc, 0);
147 * Continuation called to notify client about result of the
148 * datastore removal operation.
151 * @param success #GNUNET_SYSERR on failure
152 * @param min_expiration minimum expiration time required for content to be stored
153 * @param msg NULL on success, otherwise an error message
156 process_cont (void *cls,
158 struct GNUNET_TIME_Absolute min_expiration,
161 struct GNUNET_FS_UnindexContext *uc = cls;
163 if (success == GNUNET_SYSERR)
165 uc->emsg = GNUNET_strdup (msg);
166 signal_unindex_error (uc);
169 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
170 "Datastore REMOVE operation succeeded\n");
171 GNUNET_FS_tree_encoder_next (uc->tc);
176 * Function called asking for the current (encoded)
177 * block to be processed. After processing the
178 * client should either call "GNUNET_FS_tree_encode_next"
179 * or (on error) "GNUNET_FS_tree_encode_finish".
182 * @param chk content hash key for the block (key for lookup in the datastore)
183 * @param offset offset of the block
184 * @param depth depth of the block, 0 for DBLOCK
185 * @param type type of the block (IBLOCK or DBLOCK)
186 * @param block the (encrypted) block
187 * @param block_size size of block (in bytes)
190 unindex_process (void *cls,
191 const struct ContentHashKey *chk,
194 enum GNUNET_BLOCK_Type type,
198 struct GNUNET_FS_UnindexContext *uc = cls;
201 struct OnDemandBlock odb;
203 if (type != GNUNET_BLOCK_TYPE_FS_DBLOCK)
208 else /* on-demand encoded DBLOCK */
210 size = sizeof (struct OnDemandBlock);
211 odb.offset = GNUNET_htonll (offset);
212 odb.file_id = uc->file_id;
215 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
216 "Sending REMOVE request to DATASTORE service\n");
217 GNUNET_DATASTORE_remove (uc->dsh, &chk->query, size, data, -2, 1,
224 * Function called with the response from the
225 * FS service to our unindexing request.
227 * @param cls closure, unindex context
228 * @param msg NULL on timeout, otherwise the response
231 process_fs_response (void *cls, const struct GNUNET_MessageHeader *msg)
233 struct GNUNET_FS_UnindexContext *uc = cls;
234 struct GNUNET_FS_ProgressInfo pi;
236 if (uc->client != NULL)
238 GNUNET_CLIENT_disconnect (uc->client);
241 if (uc->state != UNINDEX_STATE_FS_NOTIFY)
243 uc->state = UNINDEX_STATE_ERROR;
245 GNUNET_strdup (_("Unexpected time for a response from `fs' service."));
246 GNUNET_FS_unindex_sync_ (uc);
247 signal_unindex_error (uc);
252 uc->state = UNINDEX_STATE_ERROR;
253 uc->emsg = GNUNET_strdup (_("Timeout waiting for `fs' service."));
254 GNUNET_FS_unindex_sync_ (uc);
255 signal_unindex_error (uc);
258 if (ntohs (msg->type) != GNUNET_MESSAGE_TYPE_FS_UNINDEX_OK)
260 uc->state = UNINDEX_STATE_ERROR;
261 uc->emsg = GNUNET_strdup (_("Invalid response from `fs' service."));
262 GNUNET_FS_unindex_sync_ (uc);
263 signal_unindex_error (uc);
266 uc->state = UNINDEX_STATE_COMPLETE;
267 pi.status = GNUNET_FS_STATUS_UNINDEX_COMPLETED;
268 pi.value.unindex.eta = GNUNET_TIME_UNIT_ZERO;
269 GNUNET_FS_unindex_sync_ (uc);
270 GNUNET_FS_unindex_make_status_ (&pi, uc, uc->file_size);
275 * Function called when we are done with removing UBlocks.
276 * Disconnect from datastore and notify FS service about
279 * @param uc our unindexing context
282 unindex_finish (struct GNUNET_FS_UnindexContext *uc)
285 struct UnindexMessage req;
287 /* generate final progress message */
288 unindex_progress (uc, uc->file_size, NULL, 0, 0);
289 GNUNET_FS_tree_encoder_finish (uc->tc, &emsg);
291 GNUNET_DISK_file_close (uc->fh);
293 GNUNET_DATASTORE_disconnect (uc->dsh, GNUNET_NO);
295 GNUNET_CONTAINER_multihashmap_destroy (uc->seen_dh);
297 uc->state = UNINDEX_STATE_FS_NOTIFY;
298 GNUNET_FS_unindex_sync_ (uc);
299 uc->client = GNUNET_CLIENT_connect ("fs", uc->h->cfg);
300 if (uc->client == NULL)
302 uc->state = UNINDEX_STATE_ERROR;
304 GNUNET_strdup (_("Failed to connect to FS service for unindexing."));
305 GNUNET_FS_unindex_sync_ (uc);
306 signal_unindex_error (uc);
309 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
310 "Sending UNINDEX message to FS service\n");
311 req.header.size = htons (sizeof (struct UnindexMessage));
312 req.header.type = htons (GNUNET_MESSAGE_TYPE_FS_UNINDEX);
314 req.file_id = uc->file_id;
315 GNUNET_break (GNUNET_OK ==
316 GNUNET_CLIENT_transmit_and_get_response (uc->client,
318 GNUNET_CONSTANTS_SERVICE_TIMEOUT,
320 &process_fs_response,
327 * Function called by the directory scanner as we extract keywords
328 * that we will need to remove UBlocks.
330 * @param cls the 'struct GNUNET_FS_UnindexContext *'
331 * @param filename which file we are making progress on
332 * @param is_directory #GNUNET_YES if this is a directory,
333 * #GNUNET_NO if this is a file
334 * #GNUNET_SYSERR if it is neither (or unknown)
335 * @param reason kind of progress we are making
338 unindex_directory_scan_cb (void *cls,
339 const char *filename,
341 enum GNUNET_FS_DirScannerProgressUpdateReason reason)
343 struct GNUNET_FS_UnindexContext *uc = cls;
344 static struct GNUNET_FS_ShareTreeItem * directory_scan_result;
348 case GNUNET_FS_DIRSCANNER_FINISHED:
349 directory_scan_result = GNUNET_FS_directory_scan_get_result (uc->dscan);
351 if (NULL != directory_scan_result->ksk_uri)
353 uc->ksk_uri = GNUNET_FS_uri_dup (directory_scan_result->ksk_uri);
354 uc->state = UNINDEX_STATE_DS_REMOVE_KBLOCKS;
355 GNUNET_FS_unindex_sync_ (uc);
356 GNUNET_FS_unindex_do_remove_kblocks_ (uc);
360 uc->emsg = GNUNET_strdup (_("Failed to get KSKs from directory scan."));
361 GNUNET_FS_unindex_sync_ (uc);
364 GNUNET_FS_share_tree_free (directory_scan_result);
366 case GNUNET_FS_DIRSCANNER_INTERNAL_ERROR:
367 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
368 _("Internal error scanning `%s'.\n"),
370 GNUNET_FS_directory_scan_abort (uc->dscan);
372 uc->emsg = GNUNET_strdup (_("Failed to get KSKs from directory scan."));
373 GNUNET_FS_unindex_sync_ (uc);
383 * If necessary, connect to the datastore and remove the UBlocks.
385 * @param uc context for the unindex operation.
388 GNUNET_FS_unindex_do_extract_keywords_ (struct GNUNET_FS_UnindexContext *uc)
393 GNUNET_CONFIGURATION_get_value_string (uc->h->cfg, "FS", "EXTRACTORS", &ex))
395 uc->dscan = GNUNET_FS_directory_scan_start (uc->filename,
397 &unindex_directory_scan_cb,
399 GNUNET_free_non_null (ex);
404 * Continuation called to notify client about result of the remove
405 * operation for the UBlock.
407 * @param cls the 'struct GNUNET_FS_UnindexContext *'
408 * @param success GNUNET_SYSERR on failure (including timeout/queue drop)
409 * GNUNET_NO if content was already there
410 * GNUNET_YES (or other positive value) on success
411 * @param min_expiration minimum expiration time required for 0-priority content to be stored
412 * by the datacache at this time, zero for unknown, forever if we have no
413 * space for 0-priority content
414 * @param msg NULL on success, otherwise an error message
417 continue_after_remove (void *cls,
419 struct GNUNET_TIME_Absolute min_expiration,
422 struct GNUNET_FS_UnindexContext *uc = cls;
425 if (success != GNUNET_YES)
426 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
427 _("Failed to remove UBlock: %s\n"),
429 GNUNET_CONTAINER_multihashmap_clear (uc->seen_dh);
431 GNUNET_FS_unindex_do_remove_kblocks_ (uc);
436 * Function called from datastore with result from us looking for
437 * a UBlock. There are four cases:
438 * 1) no result, means we move on to the next keyword
439 * 2) UID is the same as the first UID, means we move on to next keyword
440 * 3) UBlock for a different CHK, means we keep looking for more
441 * 4) UBlock is for our CHK, means we remove the block and then move
442 * on to the next keyword
444 * @param cls the 'struct GNUNET_FS_UnindexContext *'
445 * @param key key for the content
446 * @param size number of bytes in data
447 * @param data content stored
448 * @param type type of the content
449 * @param priority priority of the content
450 * @param anonymity anonymity-level for the content
451 * @param expiration expiration time for the content
452 * @param uid unique identifier for the datum;
453 * maybe 0 if no unique identifier is available
456 process_kblock_for_unindex (void *cls,
457 const struct GNUNET_HashCode *key,
460 enum GNUNET_BLOCK_Type type,
463 struct GNUNET_TIME_Absolute expiration,
466 struct GNUNET_FS_UnindexContext *uc = cls;
467 const struct UBlock *ub;
468 struct GNUNET_FS_Uri *chk_uri;
469 struct GNUNET_HashCode query;
470 struct GNUNET_HashCode dh;
476 GNUNET_CONTAINER_multihashmap_clear (uc->seen_dh);
478 GNUNET_FS_unindex_do_remove_kblocks_ (uc);
481 GNUNET_CRYPTO_hash (data,
485 GNUNET_CONTAINER_multihashmap_contains (uc->seen_dh,
488 GNUNET_CONTAINER_multihashmap_clear (uc->seen_dh);
490 GNUNET_FS_unindex_do_remove_kblocks_ (uc);
493 GNUNET_assert (GNUNET_OK ==
494 GNUNET_CONTAINER_multihashmap_put (uc->seen_dh,
497 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
498 GNUNET_assert (GNUNET_BLOCK_TYPE_FS_UBLOCK == type);
499 if (size < sizeof (struct UBlock))
505 GNUNET_CRYPTO_hash (&ub->verification_key,
506 sizeof (ub->verification_key),
508 if (0 != memcmp (&query,
510 sizeof (struct GNUNET_HashCode)))
512 /* result does not match our keyword, skip */
516 char pt[size - sizeof (struct UBlock)];
517 struct GNUNET_CRYPTO_EcdsaPublicKey anon_pub;
520 GNUNET_CRYPTO_ecdsa_key_get_public (GNUNET_CRYPTO_ecdsa_key_get_anonymous (),
522 keyword = &uc->ksk_uri->data.ksk.keywords[uc->ksk_offset][1];
523 GNUNET_FS_ublock_decrypt_ (&ub[1], size - sizeof (struct UBlock),
527 if (NULL == memchr (&pt[1], 0, sizeof (pt) - 1))
529 GNUNET_break_op (0); /* malformed UBlock */
532 chk_uri = GNUNET_FS_uri_parse (&pt[1], NULL);
535 GNUNET_break_op (0); /* malformed UBlock */
539 if (0 != memcmp (&uc->chk,
540 &chk_uri->data.chk.chk,
541 sizeof (struct ContentHashKey)))
543 /* different CHK, ignore */
544 GNUNET_FS_uri_destroy (chk_uri);
547 GNUNET_FS_uri_destroy (chk_uri);
549 uc->dqe = GNUNET_DATASTORE_remove (uc->dsh,
555 &continue_after_remove,
559 uc->dqe = GNUNET_DATASTORE_get_key (uc->dsh,
562 GNUNET_BLOCK_TYPE_FS_UBLOCK,
565 &process_kblock_for_unindex,
571 * If necessary, connect to the datastore and remove the KBlocks.
573 * @param uc context for the unindex operation.
576 GNUNET_FS_unindex_do_remove_kblocks_ (struct GNUNET_FS_UnindexContext *uc)
579 const struct GNUNET_CRYPTO_EcdsaPrivateKey *anon;
580 struct GNUNET_CRYPTO_EcdsaPublicKey anon_pub;
581 struct GNUNET_CRYPTO_EcdsaPublicKey dpub;
584 uc->dsh = GNUNET_DATASTORE_connect (uc->h->cfg);
587 uc->state = UNINDEX_STATE_ERROR;
588 uc->emsg = GNUNET_strdup (_("Failed to connect to `datastore' service."));
589 GNUNET_FS_unindex_sync_ (uc);
590 signal_unindex_error (uc);
593 if ( (NULL == uc->ksk_uri) ||
594 (uc->ksk_offset >= uc->ksk_uri->data.ksk.keywordCount) )
599 anon = GNUNET_CRYPTO_ecdsa_key_get_anonymous ();
600 GNUNET_CRYPTO_ecdsa_key_get_public (anon,
602 keyword = &uc->ksk_uri->data.ksk.keywords[uc->ksk_offset][1];
603 GNUNET_CRYPTO_ecdsa_public_key_derive (&anon_pub,
607 GNUNET_CRYPTO_hash (&dpub,
610 uc->dqe = GNUNET_DATASTORE_get_key (uc->dsh,
613 GNUNET_BLOCK_TYPE_FS_UBLOCK,
616 &process_kblock_for_unindex,
622 * Function called when the tree encoder has
623 * processed all blocks. Clean up.
625 * @param cls our unindexing context
628 unindex_extract_keywords (void *cls)
630 struct GNUNET_FS_UnindexContext *uc = cls;
632 uc->state = UNINDEX_STATE_EXTRACT_KEYWORDS;
633 GNUNET_FS_unindex_sync_ (uc);
634 GNUNET_FS_unindex_do_extract_keywords_ (uc);
639 * Connect to the datastore and remove the blocks.
641 * @param uc context for the unindex operation.
644 GNUNET_FS_unindex_do_remove_ (struct GNUNET_FS_UnindexContext *uc)
647 uc->dsh = GNUNET_DATASTORE_connect (uc->h->cfg);
650 uc->state = UNINDEX_STATE_ERROR;
651 uc->emsg = GNUNET_strdup (_("Failed to connect to `datastore' service."));
652 GNUNET_FS_unindex_sync_ (uc);
653 signal_unindex_error (uc);
657 GNUNET_DISK_file_open (uc->filename, GNUNET_DISK_OPEN_READ,
658 GNUNET_DISK_PERM_NONE);
661 GNUNET_DATASTORE_disconnect (uc->dsh, GNUNET_NO);
663 uc->state = UNINDEX_STATE_ERROR;
664 uc->emsg = GNUNET_strdup (_("Failed to open file for unindexing."));
665 GNUNET_FS_unindex_sync_ (uc);
666 signal_unindex_error (uc);
670 GNUNET_FS_tree_encoder_create (uc->h,
676 &unindex_extract_keywords);
677 GNUNET_FS_tree_encoder_next (uc->tc);
682 * Function called once the hash of the file
683 * that is being unindexed has been computed.
685 * @param cls closure, unindex context
686 * @param file_id computed hash, NULL on error
689 GNUNET_FS_unindex_process_hash_ (void *cls,
690 const struct GNUNET_HashCode *file_id)
692 struct GNUNET_FS_UnindexContext *uc = cls;
695 if (uc->state != UNINDEX_STATE_HASHING)
697 GNUNET_FS_unindex_stop (uc);
702 uc->state = UNINDEX_STATE_ERROR;
703 uc->emsg = GNUNET_strdup (_("Failed to compute hash of file."));
704 GNUNET_FS_unindex_sync_ (uc);
705 signal_unindex_error (uc);
708 uc->file_id = *file_id;
709 uc->state = UNINDEX_STATE_DS_REMOVE;
710 GNUNET_FS_unindex_sync_ (uc);
711 GNUNET_FS_unindex_do_remove_ (uc);
716 * Create SUSPEND event for the given unindex operation
717 * and then clean up our state (without stop signal).
719 * @param cls the `struct GNUNET_FS_UnindexContext` to signal for
722 GNUNET_FS_unindex_signal_suspend_ (void *cls)
724 struct GNUNET_FS_UnindexContext *uc = cls;
725 struct GNUNET_FS_ProgressInfo pi;
727 /* FIXME: lots of duplication with unindex_stop here! */
728 if (uc->dscan != NULL)
730 GNUNET_FS_directory_scan_abort (uc->dscan);
735 GNUNET_DATASTORE_cancel (uc->dqe);
740 GNUNET_CRYPTO_hash_file_cancel (uc->fhc);
743 if (NULL != uc->ksk_uri)
745 GNUNET_FS_uri_destroy (uc->ksk_uri);
748 if (uc->client != NULL)
750 GNUNET_CLIENT_disconnect (uc->client);
755 GNUNET_DATASTORE_disconnect (uc->dsh, GNUNET_NO);
760 GNUNET_FS_tree_encoder_finish (uc->tc, NULL);
765 GNUNET_DISK_file_close (uc->fh);
768 GNUNET_FS_end_top (uc->h, uc->top);
769 pi.status = GNUNET_FS_STATUS_UNINDEX_SUSPEND;
770 GNUNET_FS_unindex_make_status_ (&pi, uc,
772 UNINDEX_STATE_COMPLETE) ? uc->file_size : 0);
773 GNUNET_break (NULL == uc->client_info);
774 GNUNET_free (uc->filename);
775 GNUNET_free_non_null (uc->serialization);
776 GNUNET_free_non_null (uc->emsg);
784 * @param h handle to the file sharing subsystem
785 * @param filename file to unindex
786 * @param cctx initial value for the client context
787 * @return NULL on error, otherwise handle
789 struct GNUNET_FS_UnindexContext *
790 GNUNET_FS_unindex_start (struct GNUNET_FS_Handle *h,
791 const char *filename,
794 struct GNUNET_FS_UnindexContext *uc;
795 struct GNUNET_FS_ProgressInfo pi;
799 GNUNET_DISK_file_size (filename,
804 uc = GNUNET_new (struct GNUNET_FS_UnindexContext);
806 uc->filename = GNUNET_strdup (filename);
807 uc->start_time = GNUNET_TIME_absolute_get ();
808 uc->file_size = size;
809 uc->client_info = cctx;
810 uc->seen_dh = GNUNET_CONTAINER_multihashmap_create (4,
812 GNUNET_FS_unindex_sync_ (uc);
813 pi.status = GNUNET_FS_STATUS_UNINDEX_START;
814 pi.value.unindex.eta = GNUNET_TIME_UNIT_FOREVER_REL;
815 GNUNET_FS_unindex_make_status_ (&pi, uc, 0);
817 GNUNET_CRYPTO_hash_file (GNUNET_SCHEDULER_PRIORITY_IDLE,
820 &GNUNET_FS_unindex_process_hash_, uc);
821 uc->top = GNUNET_FS_make_top (h,
822 &GNUNET_FS_unindex_signal_suspend_,
829 * Clean up after completion of an unindex operation.
834 GNUNET_FS_unindex_stop (struct GNUNET_FS_UnindexContext *uc)
836 struct GNUNET_FS_ProgressInfo pi;
838 if (uc->dscan != NULL)
840 GNUNET_FS_directory_scan_abort (uc->dscan);
845 GNUNET_DATASTORE_cancel (uc->dqe);
850 GNUNET_CRYPTO_hash_file_cancel (uc->fhc);
853 if (uc->client != NULL)
855 GNUNET_CLIENT_disconnect (uc->client);
860 GNUNET_DATASTORE_disconnect (uc->dsh, GNUNET_NO);
863 if (NULL != uc->ksk_uri)
865 GNUNET_FS_uri_destroy (uc->ksk_uri);
870 GNUNET_FS_tree_encoder_finish (uc->tc, NULL);
875 GNUNET_DISK_file_close (uc->fh);
878 GNUNET_FS_end_top (uc->h, uc->top);
879 if (uc->serialization != NULL)
881 GNUNET_FS_remove_sync_file_ (uc->h, GNUNET_FS_SYNC_PATH_MASTER_UNINDEX,
883 GNUNET_free (uc->serialization);
884 uc->serialization = NULL;
886 pi.status = GNUNET_FS_STATUS_UNINDEX_STOPPED;
887 pi.value.unindex.eta = GNUNET_TIME_UNIT_ZERO;
888 GNUNET_FS_unindex_make_status_ (&pi, uc,
890 UNINDEX_STATE_COMPLETE) ? uc->file_size : 0);
891 GNUNET_break (NULL == uc->client_info);
892 GNUNET_free_non_null (uc->emsg);
893 GNUNET_free (uc->filename);
897 /* end of fs_unindex.c */