0b815ed3bcce6667f9513ca0d2cc27a4bfc12cf6
[oweals/gnunet.git] / src / fs / gnunet-service-fs_indexing.c
1 /*
2      This file is part of GNUnet.
3      (C) 2009, 2010 Christian Grothoff (and other contributing authors)
4
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 2, or (at your
8      option) any later version.
9
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.
14
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., 59 Temple Place - Suite 330,
18      Boston, MA 02111-1307, USA.
19 */
20
21 /**
22  * @file fs/gnunet-service-fs_indexing.c
23  * @brief program that provides indexing functions of the file-sharing service
24  * @author Christian Grothoff
25  *
26  * TODO:
27  * - consider doing GNUNET_CRYPTO_hash_file_cancel on active indexing
28  *   jobs during shutdown (currently, shutdown will only happen after
29  *   all of those are done, not sure if this is good or bad)
30  */
31 #include "platform.h"
32 #include <float.h>
33 #include "gnunet_core_service.h"
34 #include "gnunet_datastore_service.h"
35 #include "gnunet_peer_lib.h"
36 #include "gnunet_protocols.h"
37 #include "gnunet_signatures.h"
38 #include "gnunet_util_lib.h"
39 #include "gnunet-service-fs_drq.h"
40 #include "gnunet-service-fs_indexing.h"
41 #include "fs.h"
42
43 #define DEBUG_FS GNUNET_NO
44
45 /**
46  * In-memory information about indexed files (also available
47  * on-disk).
48  */
49 struct IndexInfo
50 {
51   
52   /**
53    * This is a linked list.
54    */
55   struct IndexInfo *next;
56
57   /**
58    * Name of the indexed file.  Memory allocated
59    * at the end of this struct (do not free).
60    */
61   const char *filename;
62
63   /**
64    * Context for transmitting confirmation to client,
65    * NULL if we've done this already.
66    */
67   struct GNUNET_SERVER_TransmitContext *tc;
68
69   /**
70    * Context for hashing of the file.
71    */
72   struct GNUNET_CRYPTO_FileHashContext *fhc;
73   
74   /**
75    * Hash of the contents of the file.
76    */
77   GNUNET_HashCode file_id;
78
79 };
80
81
82 /**
83  * Linked list of indexed files.
84  */
85 static struct IndexInfo *indexed_files;
86
87 /**
88  * Maps hash over content of indexed files to the respective filename.
89  * The filenames are pointers into the indexed_files linked list and
90  * do not need to be freed.
91  */
92 static struct GNUNET_CONTAINER_MultiHashMap *ifm;
93
94 /**
95  * Our scheduler.
96  */
97 static struct GNUNET_SCHEDULER_Handle *sched;
98
99 /**
100  * Our configuration.
101  */
102 static const struct GNUNET_CONFIGURATION_Handle *cfg;
103
104 /**
105  * Datastore handle.  Created and destroyed by code in
106  * gnunet-service-fs (this is an alias).
107  */
108 static struct GNUNET_DATASTORE_Handle *dsh;
109
110
111 /**
112  * Write the current index information list to disk.
113  */ 
114 static void
115 write_index_list ()
116 {
117   struct GNUNET_BIO_WriteHandle *wh;
118   char *fn;
119   struct IndexInfo *pos;  
120
121   if (GNUNET_OK !=
122       GNUNET_CONFIGURATION_get_value_filename (cfg,
123                                                "FS",
124                                                "INDEXDB",
125                                                &fn))
126     {
127       GNUNET_log (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
128                   _("Configuration option `%s' in section `%s' missing.\n"),
129                   "INDEXDB",
130                   "FS");
131       return;
132     }
133   wh = GNUNET_BIO_write_open (fn);
134   if (NULL == wh)
135     {
136       GNUNET_log (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
137                   _("Could not open `%s'.\n"),
138                   fn);
139       GNUNET_free (fn);
140       return;
141     }
142   pos = indexed_files;
143   while (pos != NULL)
144     {
145       if ( (GNUNET_OK !=
146             GNUNET_BIO_write (wh,
147                               &pos->file_id,
148                               sizeof (GNUNET_HashCode))) ||
149            (GNUNET_OK !=
150             GNUNET_BIO_write_string (wh,
151                                      pos->filename)) )
152         break;
153       pos = pos->next;
154     }
155   if (GNUNET_OK != 
156       GNUNET_BIO_write_close (wh))
157     {
158       GNUNET_log (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
159                   _("Error writing `%s'.\n"),
160                   fn);
161       GNUNET_free (fn);
162       return;
163     }
164   GNUNET_free (fn);
165 }
166
167
168 /**
169  * Read index information from disk.
170  */
171 static void
172 read_index_list ()
173 {
174   struct GNUNET_BIO_ReadHandle *rh;
175   char *fn;
176   struct IndexInfo *pos;  
177   char *fname;
178   GNUNET_HashCode hc;
179   size_t slen;
180   char *emsg;
181
182   if (GNUNET_OK !=
183       GNUNET_CONFIGURATION_get_value_filename (cfg,
184                                                "FS",
185                                                "INDEXDB",
186                                                &fn))
187     {
188       GNUNET_log (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
189                   _("Configuration option `%s' in section `%s' missing.\n"),
190                   "INDEXDB",
191                   "FS");
192       return;
193     }
194   if (GNUNET_NO == GNUNET_DISK_file_test (fn))
195     {
196       /* no index info yet */
197       GNUNET_free (fn);
198       return;
199     }
200   rh = GNUNET_BIO_read_open (fn);
201   if (NULL == rh)
202     {
203       GNUNET_log (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
204                   _("Could not open `%s'.\n"),
205                   fn);
206       GNUNET_free (fn);
207       return;
208     }
209   while ( (GNUNET_OK ==
210            GNUNET_BIO_read (rh,
211                             "Hash of indexed file",
212                             &hc,
213                             sizeof (GNUNET_HashCode))) &&
214           (GNUNET_OK ==
215            GNUNET_BIO_read_string (rh, 
216                                    "Name of indexed file",
217                                    &fname,
218                                    1024 * 16)) )
219     {
220       slen = strlen (fname) + 1;
221       pos = GNUNET_malloc (sizeof (struct IndexInfo) + slen);
222       pos->file_id = hc;
223       pos->filename = (const char *) &pos[1];
224       memcpy (&pos[1], fname, slen);
225       if (GNUNET_SYSERR ==
226           GNUNET_CONTAINER_multihashmap_put (ifm,
227                                              &hc,
228                                              (void*) pos->filename,
229                                              GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY))
230         {
231           GNUNET_free (pos);
232         }
233       else
234         {
235           pos->next = indexed_files;
236           indexed_files = pos;
237         }
238       GNUNET_free (fname);
239     }
240   if (GNUNET_OK != 
241       GNUNET_BIO_read_close (rh, &emsg))
242     GNUNET_free (emsg);
243   GNUNET_free (fn);
244 }
245
246
247 /**
248  * We've validated the hash of the file we're about to index.  Signal
249  * success to the client and update our internal data structures.
250  *
251  * @param ii the index info entry for the request
252  */
253 static void
254 signal_index_ok (struct IndexInfo *ii)
255 {
256   if (GNUNET_SYSERR ==
257       GNUNET_CONTAINER_multihashmap_put (ifm,
258                                          &ii->file_id,
259                                          (void*) ii->filename,
260                                          GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY))
261     {
262       GNUNET_log (GNUNET_ERROR_TYPE_INFO,
263                   _("Index request received for file `%s' is already indexed as `%s'.  Permitting anyway.\n"),
264                   ii->filename,
265                   (const char*) GNUNET_CONTAINER_multihashmap_get (ifm,
266                                                                    &ii->file_id));
267       GNUNET_SERVER_transmit_context_append_data (ii->tc,
268                                                   NULL, 0,
269                                                   GNUNET_MESSAGE_TYPE_FS_INDEX_START_OK);
270       GNUNET_SERVER_transmit_context_run (ii->tc,
271                                           GNUNET_TIME_UNIT_MINUTES);
272       GNUNET_free (ii);
273       return;
274     }
275   ii->next = indexed_files;
276   indexed_files = ii;
277   write_index_list ();
278   GNUNET_SERVER_transmit_context_append_data (ii->tc,
279                                               NULL, 0,
280                                               GNUNET_MESSAGE_TYPE_FS_INDEX_START_OK);
281   GNUNET_SERVER_transmit_context_run (ii->tc,
282                                       GNUNET_TIME_UNIT_MINUTES);
283   ii->tc = NULL;
284 }
285
286
287 /**
288  * Function called once the hash computation over an
289  * indexed file has completed.
290  *
291  * @param cls closure, our publishing context
292  * @param res resulting hash, NULL on error
293  */
294 static void 
295 hash_for_index_val (void *cls,
296                     const GNUNET_HashCode *
297                     res)
298 {
299   struct IndexInfo *ii = cls;
300
301   ii->fhc = NULL;
302   if ( (res == NULL) ||
303        (0 != memcmp (res,
304                      &ii->file_id,
305                      sizeof(GNUNET_HashCode))) )
306     {
307       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
308                   _("Hash mismatch trying to index file `%s' which has hash `%s'\n"),
309                   ii->filename,
310                   GNUNET_h2s (res));
311 #if DEBUG_FS
312       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
313                   "Wanted `%s'\n",
314                   GNUNET_h2s (&ii->file_id));
315 #endif
316       GNUNET_SERVER_transmit_context_append_data (ii->tc,
317                                                   NULL, 0,
318                                                   GNUNET_MESSAGE_TYPE_FS_INDEX_START_FAILED);
319       GNUNET_SERVER_transmit_context_run (ii->tc,
320                                           GNUNET_TIME_UNIT_MINUTES);
321       GNUNET_free (ii);
322       return;
323     }
324   signal_index_ok (ii);
325 }
326
327
328 /**
329  * Handle INDEX_START-message.
330  *
331  * @param cls closure
332  * @param client identification of the client
333  * @param message the actual message
334  */
335 void
336 GNUNET_FS_handle_index_start (void *cls,
337                               struct GNUNET_SERVER_Client *client,
338                               const struct GNUNET_MessageHeader *message)
339 {
340   const struct IndexStartMessage *ism;
341   char *fn;
342   uint16_t msize;
343   struct IndexInfo *ii;
344   size_t slen;
345   uint64_t dev;
346   uint64_t ino;
347   uint64_t mydev;
348   uint64_t myino;
349
350   msize = ntohs(message->size);
351   if ( (msize <= sizeof (struct IndexStartMessage)) ||
352        ( ((const char *)message)[msize-1] != '\0') )
353     {
354       GNUNET_break (0);
355       GNUNET_SERVER_receive_done (client,
356                                   GNUNET_SYSERR);
357       return;
358     }
359   ism = (const struct IndexStartMessage*) message;
360   fn = GNUNET_STRINGS_filename_expand ((const char*) &ism[1]);
361   if (fn == NULL)
362     {
363       GNUNET_SERVER_receive_done (client,
364                                   GNUNET_SYSERR);
365       return;
366     }
367   dev = GNUNET_ntohll (ism->device);
368   ino = GNUNET_ntohll (ism->inode);
369   ism = (const struct IndexStartMessage*) message;
370   slen = strlen (fn) + 1;
371   ii = GNUNET_malloc (sizeof (struct IndexInfo) + slen);
372   ii->filename = (const char*) &ii[1];
373   memcpy (&ii[1], fn, slen);
374   ii->file_id = ism->file_id;  
375 #if DEBUG_FS
376   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
377               "Received `%s' message for file `%s'\n",
378               "START_INDEX",
379               ii->filename);
380 #endif
381
382   ii->tc = GNUNET_SERVER_transmit_context_create (client);
383   mydev = 0;
384   myino = 0;
385   if ( ( (dev != 0) ||
386          (ino != 0) ) &&
387        (GNUNET_OK == GNUNET_DISK_file_get_identifiers (fn,
388                                                        &mydev,
389                                                        &myino)) &&
390        ( (dev == mydev) &&
391          (ino == myino) ) )
392     {      
393       /* fast validation OK! */
394       signal_index_ok (ii);
395       GNUNET_free (fn);
396       return;
397     }
398 #if DEBUG_FS
399   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
400               "Mismatch in file identifiers (%llu != %llu or %u != %u), need to hash.\n",
401               (unsigned long long) ino,
402               (unsigned long long) myino,
403               (unsigned int) dev,
404               (unsigned int) mydev);
405 #endif
406   /* slow validation, need to hash full file (again) */
407   ii->fhc = GNUNET_CRYPTO_hash_file (sched,
408                                      GNUNET_SCHEDULER_PRIORITY_IDLE,
409                                      fn,
410                                      HASHING_BLOCKSIZE,
411                                      &hash_for_index_val,
412                                      ii);
413   if (ii->fhc == NULL)    
414     hash_for_index_val (ii, NULL);    
415   GNUNET_free (fn);
416 }
417
418
419 /**
420  * Handle INDEX_LIST_GET-message.
421  *
422  * @param cls closure
423  * @param client identification of the client
424  * @param message the actual message
425  */
426 void
427 GNUNET_FS_handle_index_list_get (void *cls,
428                                  struct GNUNET_SERVER_Client *client,
429                                  const struct GNUNET_MessageHeader *message)
430 {
431   struct GNUNET_SERVER_TransmitContext *tc;
432   struct IndexInfoMessage *iim;
433   char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE - 1];
434   size_t slen;
435   const char *fn;
436   struct IndexInfo *pos;
437
438   tc = GNUNET_SERVER_transmit_context_create (client);
439   iim = (struct IndexInfoMessage*) buf;
440   pos = indexed_files;
441   while (NULL != pos)
442     {
443       fn = pos->filename;
444       slen = strlen (fn) + 1;
445       if (slen + sizeof (struct IndexInfoMessage) >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
446         {
447           GNUNET_break (0);
448           break;
449         }
450       iim->header.type = htons (GNUNET_MESSAGE_TYPE_FS_INDEX_LIST_ENTRY);
451       iim->header.size = htons (slen + sizeof (struct IndexInfoMessage));
452       iim->reserved = 0;
453       iim->file_id = pos->file_id;
454       memcpy (&iim[1], fn, slen);
455       GNUNET_SERVER_transmit_context_append_message (tc,
456                                                      &iim->header);
457       pos = pos->next;
458     }
459   GNUNET_SERVER_transmit_context_append_data (tc,
460                                               NULL, 0,
461                                               GNUNET_MESSAGE_TYPE_FS_INDEX_LIST_END);
462   GNUNET_SERVER_transmit_context_run (tc,
463                                       GNUNET_TIME_UNIT_MINUTES);
464 }
465
466
467 /**
468  * Handle UNINDEX-message.
469  *
470  * @param cls closure
471  * @param client identification of the client
472  * @param message the actual message
473  */
474 void
475 GNUNET_FS_handle_unindex (void *cls,
476                           struct GNUNET_SERVER_Client *client,
477                           const struct GNUNET_MessageHeader *message)
478 {
479   const struct UnindexMessage *um;
480   struct IndexInfo *pos;
481   struct IndexInfo *prev;
482   struct IndexInfo *next;
483   struct GNUNET_SERVER_TransmitContext *tc;
484   int found;
485
486   um = (const struct UnindexMessage*) message;
487   found = GNUNET_NO;
488   prev = NULL;
489   pos = indexed_files;
490   while (NULL != pos)
491     {
492       next = pos->next;
493       if (0 == memcmp (&pos->file_id,
494                        &um->file_id,
495                        sizeof (GNUNET_HashCode)))
496         {
497           if (prev == NULL)
498             indexed_files = next;
499           else
500             prev->next = next;
501           GNUNET_break (GNUNET_OK ==
502                         GNUNET_CONTAINER_multihashmap_remove (ifm,
503                                                               &pos->file_id,
504                                                               (void*) pos->filename));
505           GNUNET_free (pos);
506           found = GNUNET_YES;
507         }
508       else
509         {
510           prev = pos;
511         }
512       pos = next;
513     }
514 #if DEBUG_FS
515   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
516               "Client requested unindexing of file `%s': %s\n",
517               GNUNET_h2s (&um->file_id),
518               found ? "found" : "not found");
519 #endif
520   if (GNUNET_YES == found)    
521     write_index_list ();
522   tc = GNUNET_SERVER_transmit_context_create (client);
523   GNUNET_SERVER_transmit_context_append_data (tc,
524                                               NULL, 0,
525                                               GNUNET_MESSAGE_TYPE_FS_UNINDEX_OK);
526   GNUNET_SERVER_transmit_context_run (tc,
527                                       GNUNET_TIME_UNIT_MINUTES);
528 }
529
530
531
532
533 /**
534  * Continuation called from datastore's remove
535  * function.
536  *
537  * @param cls unused
538  * @param success did the deletion work?
539  * @param msg error message
540  */
541 static void
542 remove_cont (void *cls,
543              int success,
544              const char *msg)
545 {
546   if (GNUNET_OK != success)
547     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
548                 _("Failed to delete bogus block: %s\n"),
549                 msg);
550 }
551
552
553 /**
554  * We've received an on-demand encoded block from the datastore.
555  * Attempt to do on-demand encoding and (if successful), call the
556  * continuation with the resulting block.  On error, clean up and ask
557  * the datastore for more results.
558  *
559  * @param key key for the content
560  * @param size number of bytes in data
561  * @param data content stored
562  * @param type type of the content
563  * @param priority priority of the content
564  * @param anonymity anonymity-level for the content
565  * @param expiration expiration time for the content
566  * @param uid unique identifier for the datum;
567  *        maybe 0 if no unique identifier is available
568  * @param cont function to call with the actual block (at most once, on success)
569  * @param cont_cls closure for cont
570  * @return GNUNET_OK on success
571  */
572 int
573 GNUNET_FS_handle_on_demand_block (const GNUNET_HashCode * key,
574                                   uint32_t size,
575                                   const void *data,
576                                   enum GNUNET_BLOCK_Type type,
577                                   uint32_t priority,
578                                   uint32_t anonymity,
579                                   struct GNUNET_TIME_Absolute
580                                   expiration, uint64_t uid,
581                                   GNUNET_DATASTORE_Iterator cont,
582                                   void *cont_cls)
583 {
584   const struct OnDemandBlock *odb;
585   GNUNET_HashCode nkey;
586   struct GNUNET_CRYPTO_AesSessionKey skey;
587   struct GNUNET_CRYPTO_AesInitializationVector iv;
588   GNUNET_HashCode query;
589   ssize_t nsize;
590   char ndata[DBLOCK_SIZE];
591   char edata[DBLOCK_SIZE];
592   const char *fn;
593   struct GNUNET_DISK_FileHandle *fh;
594   uint64_t off;
595
596   if (size != sizeof (struct OnDemandBlock))
597     {
598       GNUNET_break (0);
599       GNUNET_DATASTORE_remove (dsh,
600                                key,
601                                size,
602                                data,
603                                -1, -1,
604                                GNUNET_TIME_UNIT_FOREVER_REL,
605                                &remove_cont,
606                                NULL);
607       return GNUNET_SYSERR;
608     }
609   odb = (const struct OnDemandBlock*) data;
610   off = GNUNET_ntohll (odb->offset);
611   fn = (const char*) GNUNET_CONTAINER_multihashmap_get (ifm,
612                                                         &odb->file_id);
613   fh = NULL;
614   if ( (NULL == fn) ||
615        (NULL == (fh = GNUNET_DISK_file_open (fn, 
616                                              GNUNET_DISK_OPEN_READ,
617                                              GNUNET_DISK_PERM_NONE))) ||
618        (off !=
619         GNUNET_DISK_file_seek (fh,
620                                off,
621                                GNUNET_DISK_SEEK_SET)) ||
622        (-1 ==
623         (nsize = GNUNET_DISK_file_read (fh,
624                                         ndata,
625                                         sizeof (ndata)))) )
626     {
627       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
628                   _("Could not access indexed file `%s' (%s) at offset %llu: %s\n"),
629                   GNUNET_h2s (&odb->file_id),
630                   fn,
631                   (unsigned long long) off,
632                   (fn == NULL) ? _("not indexed") : STRERROR (errno));
633       if (fh != NULL)
634         GNUNET_DISK_file_close (fh);
635       GNUNET_DATASTORE_remove (dsh,
636                                key,
637                                size,
638                                data,
639                                -1, -1,
640                                GNUNET_TIME_UNIT_FOREVER_REL,
641                                &remove_cont,
642                                NULL);
643       return GNUNET_SYSERR;
644     }
645   GNUNET_DISK_file_close (fh);
646   GNUNET_CRYPTO_hash (ndata,
647                       nsize,
648                       &nkey);
649   GNUNET_CRYPTO_hash_to_aes_key (&nkey, &skey, &iv);
650   GNUNET_CRYPTO_aes_encrypt (ndata,
651                              nsize,
652                              &skey,
653                              &iv,
654                              edata);
655   GNUNET_CRYPTO_hash (edata,
656                       nsize,
657                       &query);
658   if (0 != memcmp (&query, 
659                    key,
660                    sizeof (GNUNET_HashCode)))
661     {
662       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
663                   _("Indexed file `%s' changed at offset %llu\n"),
664                   fn,
665                   (unsigned long long) off);
666       GNUNET_DATASTORE_remove (dsh,
667                                key,
668                                size,
669                                data,
670                                -1, -1,
671                                GNUNET_TIME_UNIT_FOREVER_REL,
672                                &remove_cont,
673                                NULL);
674       return GNUNET_SYSERR;
675     }
676 #if DEBUG_FS
677       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
678                   "On-demand encoded block for query `%s'\n",
679                   GNUNET_h2s (key));
680 #endif  
681   cont (cont_cls,
682         key,
683         nsize,
684         edata,
685         GNUNET_BLOCK_TYPE_DBLOCK,
686         priority,
687         anonymity,
688         expiration,
689         uid);
690   return GNUNET_OK;
691 }
692
693
694 /**
695  * Task run during shutdown.
696  *
697  * @param cls unused
698  * @param tc unused
699  */
700 static void
701 shutdown_task (void *cls,
702                const struct GNUNET_SCHEDULER_TaskContext *tc)
703 {
704   struct IndexInfo *pos;  
705
706   GNUNET_CONTAINER_multihashmap_destroy (ifm);
707   ifm = NULL;
708   while (NULL != (pos = indexed_files))
709     {
710       indexed_files = pos->next;
711       GNUNET_free (pos);
712     }
713   sched = NULL;
714   cfg = NULL;
715 }
716
717
718 /**
719  * Initialize the indexing submodule.
720  *
721  * @param s scheduler to use
722  * @param c configuration to use
723  * @param d datastore to use
724  */
725 int
726 GNUNET_FS_indexing_init (struct GNUNET_SCHEDULER_Handle *s,
727                          const struct GNUNET_CONFIGURATION_Handle *c,
728                          struct GNUNET_DATASTORE_Handle *d)
729 {
730   sched = s;
731   cfg = c;
732   dsh = d;
733   ifm = GNUNET_CONTAINER_multihashmap_create (128);
734   GNUNET_SCHEDULER_add_delayed (sched,
735                                 GNUNET_TIME_UNIT_FOREVER_REL,
736                                 &shutdown_task,
737                                 NULL);
738   read_index_list ();
739   return GNUNET_OK;
740 }
741
742 /* end of gnunet-service-fs_indexing.c */