2 This file is part of GNUnet.
3 (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009 Christian Grothoff (and other contributing authors)
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.
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., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @file fs/fs_search.c
23 * @brief Helper functions for searching.
24 * @author Christian Grothoff
27 * - handle SKS updates searches nicely (can wait)
28 * - handle availability probes (can wait)
29 * - make operations persistent (can wait)
30 * - handle namespace advertisements (can wait)
31 * - add support for pushing "already seen" information
32 * to FS service for bloomfilter (can wait)
36 #include "gnunet_constants.h"
37 #include "gnunet_fs_service.h"
38 #include "gnunet_protocols.h"
41 #define DEBUG_SEARCH GNUNET_YES
46 * Fill in all of the generic fields for
49 * @param pi structure to fill in
50 * @param sc overall search context
53 make_search_status (struct GNUNET_FS_ProgressInfo *pi,
54 struct GNUNET_FS_SearchContext *sc)
56 pi->value.search.sc = sc;
60 = (sc->parent == NULL) ? NULL : sc->parent->client_info;
61 pi->value.search.query
63 pi->value.search.duration = GNUNET_TIME_absolute_get_duration (sc->start_time);
64 pi->value.search.anonymity = sc->anonymity;
69 * Check if the given result is identical
72 * @param cls points to the URI we check against
74 * @param value a "struct SearchResult" who's URI we
76 * @return GNUNET_SYSERR if the result is present,
80 test_result_present (void *cls,
81 const GNUNET_HashCode * key,
84 const struct GNUNET_FS_Uri *uri = cls;
85 struct SearchResult *sr = value;
87 if (GNUNET_FS_uri_test_equal (uri,
95 * We've found a new CHK result. Let the client
98 * @param sc the search context
99 * @param sr the specific result
102 notify_client_chk_result (struct GNUNET_FS_SearchContext *sc,
103 struct SearchResult *sr)
105 struct GNUNET_FS_ProgressInfo pi;
107 pi.status = GNUNET_FS_STATUS_SEARCH_RESULT;
108 make_search_status (&pi, sc);
109 pi.value.search.specifics.result.meta = sr->meta;
110 pi.value.search.specifics.result.uri = sr->uri;
111 sr->client_info = sc->h->upcb (sc->h->upcb_cls,
117 * We've found new information about an existing CHK result. Let the
118 * client know about it.
120 * @param sc the search context
121 * @param sr the specific result
124 notify_client_chk_update (struct GNUNET_FS_SearchContext *sc,
125 struct SearchResult *sr)
127 struct GNUNET_FS_ProgressInfo pi;
129 pi.status = GNUNET_FS_STATUS_SEARCH_UPDATE;
130 make_search_status (&pi, sc);
131 pi.value.search.specifics.update.cctx = sr->client_info;
132 pi.value.search.specifics.update.meta = sr->meta;
133 pi.value.search.specifics.update.uri = sr->uri;
134 pi.value.search.specifics.update.availability_rank
135 = 2*sr->availability_success - sr->availability_trials;
136 pi.value.search.specifics.update.availability_certainty
137 = sr->availability_trials;
138 pi.value.search.specifics.update.applicability_rank
139 = sr->optional_support;
140 sr->client_info = sc->h->upcb (sc->h->upcb_cls,
146 * Context for "get_result_present".
148 struct GetResultContext
151 * The URI we're looking for.
153 const struct GNUNET_FS_Uri *uri;
156 * Where to store a pointer to the search
157 * result struct if we found a match.
159 struct SearchResult *sr;
164 * Check if the given result is identical
165 * to the given URI and if so return it.
167 * @param cls a "struct GetResultContext"
168 * @param key not used
169 * @param value a "struct SearchResult" who's URI we
170 * should compare with
174 get_result_present (void *cls,
175 const GNUNET_HashCode * key,
178 struct GetResultContext *grc = cls;
179 struct SearchResult *sr = value;
181 if (GNUNET_FS_uri_test_equal (grc->uri,
189 * We have received a KSK result. Check
190 * how it fits in with the overall query
191 * and notify the client accordingly.
193 * @param sc context for the overall query
194 * @param ent entry for the specific keyword
195 * @param uri the URI that was found
196 * @param meta metadata associated with the URI
197 * under the "ent" keyword
200 process_ksk_result (struct GNUNET_FS_SearchContext *sc,
201 struct SearchRequestEntry *ent,
202 const struct GNUNET_FS_Uri *uri,
203 const struct GNUNET_CONTAINER_MetaData *meta)
206 struct SearchResult *sr;
207 struct GetResultContext grc;
211 if (! GNUNET_FS_uri_test_chk (uri))
216 GNUNET_CRYPTO_hash_xor (&uri->data.chk.chk.key,
217 &uri->data.chk.chk.query,
220 GNUNET_CONTAINER_multihashmap_get_multiple (ent->results,
222 &test_result_present,
224 return; /* duplicate result */
225 /* try to find search result in master map */
228 GNUNET_CONTAINER_multihashmap_get_multiple (sc->master_result_map,
233 is_new = (NULL == sr) || (sr->mandatory_missing > 0);
236 sr = GNUNET_malloc (sizeof (struct SearchResult));
237 sr->uri = GNUNET_FS_uri_dup (uri);
238 sr->meta = GNUNET_CONTAINER_meta_data_duplicate (meta);
239 sr->mandatory_missing = sc->mandatory_count;
240 GNUNET_CONTAINER_multihashmap_put (sc->master_result_map,
243 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
247 /* FIXME: consider combining the meta data */
249 /* check if mandatory satisfied */
251 sr->mandatory_missing--;
253 sr->optional_support++;
254 if (0 != sr->mandatory_missing)
257 notify_client_chk_result (sc, sr);
259 notify_client_chk_update (sc, sr);
260 /* FIXME: consider starting probes for "sr" */
265 * Start search for content, internal API.
267 * @param h handle to the file sharing subsystem
268 * @param uri specifies the search parameters; can be
269 * a KSK URI or an SKS URI.
270 * @param anonymity desired level of anonymity
271 * @param parent parent search (for namespace update searches)
272 * @return context that can be used to control the search
274 static struct GNUNET_FS_SearchContext *
275 search_start (struct GNUNET_FS_Handle *h,
276 const struct GNUNET_FS_Uri *uri,
278 struct GNUNET_FS_SearchContext *parent);
282 * We have received an SKS result. Start
283 * searching for updates and notify the
284 * client if it is a new result.
286 * @param sc context for the overall query
287 * @param id_update identifier for updates, NULL for none
288 * @param uri the URI that was found
289 * @param meta metadata associated with the URI
292 process_sks_result (struct GNUNET_FS_SearchContext *sc,
293 const char *id_update,
294 const struct GNUNET_FS_Uri *uri,
295 const struct GNUNET_CONTAINER_MetaData *meta)
297 struct GNUNET_FS_Uri uu;
299 struct SearchResult *sr;
302 if (! GNUNET_FS_uri_test_ksk (uri))
307 GNUNET_CRYPTO_hash_xor (&uri->data.chk.chk.key,
308 &uri->data.chk.chk.query,
311 GNUNET_CONTAINER_multihashmap_get_multiple (sc->master_result_map,
313 &test_result_present,
315 return; /* duplicate result */
316 sr = GNUNET_malloc (sizeof (struct SearchResult));
317 sr->uri = GNUNET_FS_uri_dup (uri);
318 sr->meta = GNUNET_CONTAINER_meta_data_duplicate (meta);
319 GNUNET_CONTAINER_multihashmap_put (sc->master_result_map,
322 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
323 /* FIXME: consider starting probes for "sr" */
326 notify_client_chk_result (sc, sr);
327 /* search for updates */
328 if (strlen (id_update) == 0)
329 return; /* no updates */
331 uu.data.sks.namespace = sc->uri->data.sks.namespace;
332 uu.data.sks.identifier = GNUNET_strdup (id_update);
333 /* FIXME: should attach update search
334 to the individual result, not
335 the entire SKS search! */
344 * Process a keyword-search result.
346 * @param sc our search context
347 * @param kb the kblock
348 * @param size size of kb
351 process_kblock (struct GNUNET_FS_SearchContext *sc,
352 const struct KBlock *kb,
358 char pt[size - sizeof (struct KBlock)];
359 struct GNUNET_CRYPTO_AesSessionKey skey;
360 struct GNUNET_CRYPTO_AesInitializationVector iv;
362 struct GNUNET_CONTAINER_MetaData *meta;
363 struct GNUNET_FS_Uri *uri;
366 GNUNET_CRYPTO_hash (&kb->keyspace,
367 sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
370 for (i=0;i<sc->uri->data.ksk.keywordCount;i++)
372 &sc->requests[i].query,
373 sizeof (GNUNET_HashCode)))
375 if (i == sc->uri->data.ksk.keywordCount)
377 /* oops, does not match any of our keywords!? */
382 GNUNET_CRYPTO_hash_to_aes_key (&sc->requests[i].key, &skey, &iv);
383 GNUNET_CRYPTO_aes_decrypt (&kb[1],
384 size - sizeof (struct KBlock),
389 eos = memchr (pt, 0, sizeof (pt));
396 meta = GNUNET_CONTAINER_meta_data_deserialize (&pt[j],
400 GNUNET_break_op (0); /* kblock malformed */
403 uri = GNUNET_FS_uri_parse (pt, &emsg);
406 GNUNET_break_op (0); /* kblock malformed */
407 GNUNET_free_non_null (emsg);
408 GNUNET_CONTAINER_meta_data_destroy (meta);
412 process_ksk_result (sc, &sc->requests[i], uri, meta);
415 GNUNET_CONTAINER_meta_data_destroy (meta);
416 GNUNET_FS_uri_destroy (uri);
421 * Process a namespace-search result.
423 * @param sc our search context
424 * @param sb the sblock
425 * @param size size of sb
428 process_sblock (struct GNUNET_FS_SearchContext *sc,
429 const struct SBlock *sb,
432 size_t len = size - sizeof (struct SBlock);
434 struct GNUNET_CRYPTO_AesSessionKey skey;
435 struct GNUNET_CRYPTO_AesInitializationVector iv;
436 struct GNUNET_FS_Uri *uri;
437 struct GNUNET_CONTAINER_MetaData *meta;
446 identifier = sc->uri->data.sks.identifier;
447 GNUNET_CRYPTO_hash (identifier,
450 GNUNET_CRYPTO_hash_to_aes_key (&key, &skey, &iv);
451 GNUNET_CRYPTO_aes_encrypt (&sb[1],
457 off = GNUNET_STRINGS_buffer_tokenize (pt,
464 GNUNET_break_op (0); /* sblock malformed */
467 meta = GNUNET_CONTAINER_meta_data_deserialize (&pt[off],
471 GNUNET_break_op (0); /* sblock malformed */
474 uri = GNUNET_FS_uri_parse (uris, &emsg);
477 GNUNET_break_op (0); /* sblock malformed */
478 GNUNET_free_non_null (emsg);
479 GNUNET_CONTAINER_meta_data_destroy (meta);
483 process_sks_result (sc, id, uri, meta);
485 GNUNET_FS_uri_destroy (uri);
486 GNUNET_CONTAINER_meta_data_destroy (meta);
491 * Process a search result.
493 * @param sc our search context
494 * @param type type of the result
495 * @param expiration when it will expire
496 * @param data the (encrypted) response
497 * @param size size of data
500 process_result (struct GNUNET_FS_SearchContext *sc,
502 struct GNUNET_TIME_Absolute expiration,
506 if (GNUNET_TIME_absolute_get_duration (expiration).value > 0)
507 return; /* result expired */
510 case GNUNET_DATASTORE_BLOCKTYPE_KBLOCK:
511 if (! GNUNET_FS_uri_test_ksk (sc->uri))
516 if (sizeof (struct KBlock) > size)
521 process_kblock (sc, data, size);
523 case GNUNET_DATASTORE_BLOCKTYPE_SBLOCK:
524 if (! GNUNET_FS_uri_test_ksk (sc->uri))
529 if (sizeof (struct SBlock) > size)
534 process_sblock (sc, data, size);
536 case GNUNET_DATASTORE_BLOCKTYPE_ANY:
537 case GNUNET_DATASTORE_BLOCKTYPE_DBLOCK:
538 case GNUNET_DATASTORE_BLOCKTYPE_ONDEMAND:
539 case GNUNET_DATASTORE_BLOCKTYPE_IBLOCK:
543 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
544 _("Got result with unknown block type `%d', ignoring"),
552 * Shutdown any existing connection to the FS
553 * service and try to establish a fresh one
554 * (and then re-transmit our search request).
556 * @param sc the search to reconnec
559 try_reconnect (struct GNUNET_FS_SearchContext *sc);
563 * Type of a function to call when we receive a message
567 * @param msg message received, NULL on timeout or fatal error
570 receive_results (void *cls,
571 const struct GNUNET_MessageHeader * msg)
573 struct GNUNET_FS_SearchContext *sc = cls;
574 const struct ContentMessage *cm;
577 if ( (NULL == msg) ||
578 (ntohs (msg->type) != GNUNET_MESSAGE_TYPE_FS_CONTENT) ||
579 (ntohs (msg->size) <= sizeof (struct ContentMessage)) )
584 msize = ntohs (msg->size);
585 cm = (const struct ContentMessage*) msg;
588 GNUNET_TIME_absolute_ntoh (cm->expiration),
590 msize - sizeof (struct ContentMessage));
591 /* continue receiving */
592 GNUNET_CLIENT_receive (sc->client,
595 GNUNET_TIME_UNIT_FOREVER_REL);
600 * We're ready to transmit the search request to the
601 * file-sharing service. Do it.
604 * @param size number of bytes available in buf
605 * @param buf where the callee should write the message
606 * @return number of bytes written to buf
609 transmit_search_request (void *cls,
613 struct GNUNET_FS_SearchContext *sc = cls;
615 struct SearchMessage *sm;
617 const char *identifier;
625 if (GNUNET_FS_uri_test_ksk (sc->uri))
627 msize = sizeof (struct SearchMessage) * sc->uri->data.ksk.keywordCount;
628 GNUNET_assert (size >= msize);
630 memset (sm, 0, msize);
631 for (i=0;i<sc->uri->data.ksk.keywordCount;i++)
633 sm[i].header.size = htons (sizeof (struct SearchMessage));
634 sm[i].header.type = htons (GNUNET_MESSAGE_TYPE_FS_START_SEARCH);
635 sm[i].anonymity_level = htonl (sc->anonymity);
636 sm[i].query = sc->requests[i].query;
641 msize = sizeof (struct SearchMessage);
642 GNUNET_assert (size >= msize);
644 memset (sm, 0, msize);
645 sm->header.size = htons (sizeof (struct SearchMessage));
646 sm->header.type = htons (GNUNET_MESSAGE_TYPE_FS_START_SEARCH);
647 sm->anonymity_level = htonl (sc->anonymity);
648 sm->target = sc->uri->data.sks.namespace;
649 identifier = sc->uri->data.sks.identifier;
650 GNUNET_CRYPTO_hash (identifier,
653 GNUNET_CRYPTO_hash_xor (&idh,
657 GNUNET_CLIENT_receive (sc->client,
660 GNUNET_TIME_UNIT_FOREVER_REL);
666 * Reconnect to the FS service and transmit
669 * @param cls our search context
673 do_reconnect (void *cls,
674 const struct GNUNET_SCHEDULER_TaskContext *tc)
676 struct GNUNET_FS_SearchContext *sc = cls;
677 struct GNUNET_CLIENT_Connection *client;
680 sc->task = GNUNET_SCHEDULER_NO_TASK;
681 client = GNUNET_CLIENT_connect (sc->h->sched,
690 if (GNUNET_FS_uri_test_ksk (sc->uri))
691 size = sizeof (struct SearchMessage) * sc->uri->data.ksk.keywordCount;
693 size = sizeof (struct SearchMessage);
694 GNUNET_CLIENT_notify_transmit_ready (client,
696 GNUNET_CONSTANTS_SERVICE_TIMEOUT,
698 &transmit_search_request,
704 * Shutdown any existing connection to the FS
705 * service and try to establish a fresh one
706 * (and then re-transmit our search request).
708 * @param sc the search to reconnec
711 try_reconnect (struct GNUNET_FS_SearchContext *sc)
713 if (NULL != sc->client)
715 GNUNET_CLIENT_disconnect (sc->client);
719 = GNUNET_SCHEDULER_add_delayed (sc->h->sched,
721 GNUNET_SCHEDULER_PRIORITY_IDLE,
722 GNUNET_SCHEDULER_NO_TASK,
723 GNUNET_TIME_UNIT_SECONDS,
730 * Start search for content, internal API.
732 * @param h handle to the file sharing subsystem
733 * @param uri specifies the search parameters; can be
734 * a KSK URI or an SKS URI.
735 * @param anonymity desired level of anonymity
736 * @param parent parent search (for namespace update searches)
737 * @return context that can be used to control the search
739 static struct GNUNET_FS_SearchContext *
740 search_start (struct GNUNET_FS_Handle *h,
741 const struct GNUNET_FS_Uri *uri,
743 struct GNUNET_FS_SearchContext *parent)
745 struct GNUNET_FS_SearchContext *sc;
746 struct GNUNET_CLIENT_Connection *client;
747 struct GNUNET_FS_ProgressInfo pi;
752 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pub;
753 struct GNUNET_CRYPTO_RsaPrivateKey *pk;
755 if (GNUNET_FS_uri_test_ksk (uri))
757 size = sizeof (struct SearchMessage) * uri->data.ksk.keywordCount;
761 GNUNET_assert (GNUNET_FS_uri_test_sks (uri));
762 size = sizeof (struct SearchMessage);
764 if (size >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
766 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
767 _("Too many keywords specified for a single search."));
770 client = GNUNET_CLIENT_connect (h->sched,
775 sc = GNUNET_malloc (sizeof(struct GNUNET_FS_SearchContext));
777 sc->uri = GNUNET_FS_uri_dup (uri);
778 sc->anonymity = anonymity;
779 sc->start_time = GNUNET_TIME_absolute_get ();
782 sc->master_result_map = GNUNET_CONTAINER_multihashmap_create (16);
784 sc->requests = GNUNET_malloc (sizeof (struct SearchRequestEntry) *
785 sc->uri->data.ksk.keywordCount);
786 for (i=0;i<sc->uri->data.ksk.keywordCount;i++)
788 keyword = &sc->uri->data.ksk.keywords[i][1];
789 GNUNET_CRYPTO_hash (keyword, strlen (keyword), &hc);
790 pk = GNUNET_CRYPTO_rsa_key_create_from_hash (&hc);
791 GNUNET_CRYPTO_rsa_key_get_public (pk, &pub);
792 GNUNET_CRYPTO_rsa_key_free (pk);
793 GNUNET_CRYPTO_hash (&pub,
794 sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
795 &sc->requests[i].query);
796 sc->requests[i].mandatory = (sc->uri->data.ksk.keywords[i][0] == '+');
797 if (sc->requests[i].mandatory)
798 sc->mandatory_count++;
799 sc->requests[i].results = GNUNET_CONTAINER_multihashmap_create (4);
800 GNUNET_CRYPTO_hash (keyword,
802 &sc->requests[i].key);
806 // FIXME: need to track children
807 // in parent in case parent is stopped!
809 pi.status = GNUNET_FS_STATUS_SEARCH_START;
810 make_search_status (&pi, sc);
811 sc->client_info = h->upcb (h->upcb_cls,
813 GNUNET_CLIENT_notify_transmit_ready (client,
815 GNUNET_CONSTANTS_SERVICE_TIMEOUT,
817 &transmit_search_request,
824 * Start search for content.
826 * @param h handle to the file sharing subsystem
827 * @param uri specifies the search parameters; can be
828 * a KSK URI or an SKS URI.
829 * @param anonymity desired level of anonymity
830 * @return context that can be used to control the search
832 struct GNUNET_FS_SearchContext *
833 GNUNET_FS_search_start (struct GNUNET_FS_Handle *h,
834 const struct GNUNET_FS_Uri *uri,
837 return search_start (h, uri, anonymity, NULL);
844 * @param sc context for the search that should be paused
847 GNUNET_FS_search_pause (struct GNUNET_FS_SearchContext *sc)
849 struct GNUNET_FS_ProgressInfo pi;
851 if (sc->task != GNUNET_SCHEDULER_NO_TASK)
852 GNUNET_SCHEDULER_cancel (sc->h->sched,
854 sc->task = GNUNET_SCHEDULER_NO_TASK;
855 if (NULL != sc->client)
856 GNUNET_CLIENT_disconnect (sc->client);
858 // FIXME: make persistent!
859 // FIXME: should this freeze all active probes?
860 pi.status = GNUNET_FS_STATUS_SEARCH_PAUSED;
861 make_search_status (&pi, sc);
862 sc->client_info = sc->h->upcb (sc->h->upcb_cls,
868 * Continue paused search.
870 * @param sc context for the search that should be resumed
873 GNUNET_FS_search_continue (struct GNUNET_FS_SearchContext *sc)
875 struct GNUNET_FS_ProgressInfo pi;
877 GNUNET_assert (sc->client == NULL);
878 GNUNET_assert (sc->task == GNUNET_SCHEDULER_NO_TASK);
879 do_reconnect (sc, NULL);
880 // FIXME: make persistent!
881 pi.status = GNUNET_FS_STATUS_SEARCH_CONTINUED;
882 make_search_status (&pi, sc);
883 sc->client_info = sc->h->upcb (sc->h->upcb_cls,
889 * Free the given search result.
891 * @param cls the global FS handle
892 * @param key the key for the search result (unused)
893 * @param value the search result to free
897 search_result_free (void *cls,
898 const GNUNET_HashCode * key,
901 struct GNUNET_FS_SearchContext *sc = cls;
902 struct GNUNET_FS_Handle *h = sc->h;
903 struct SearchResult *sr = value;
904 struct GNUNET_FS_ProgressInfo pi;
906 pi.status = GNUNET_FS_STATUS_SEARCH_RESULT_STOPPED;
907 make_search_status (&pi, sc);
908 pi.value.search.specifics.result_stopped.cctx = sr->client_info;
909 pi.value.search.specifics.result_stopped.meta = sr->meta;
910 pi.value.search.specifics.result_stopped.uri = sr->uri;
911 sr->client_info = h->upcb (h->upcb_cls,
913 GNUNET_break (NULL == sr->client_info);
915 GNUNET_FS_uri_destroy (sr->uri);
916 GNUNET_CONTAINER_meta_data_destroy (sr->meta);
917 if (sr->probe_ctx != NULL)
919 GNUNET_FS_download_stop (sr->probe_ctx, GNUNET_YES);
921 /* FIXME: trigger starting of new
922 probes here!? Maybe not -- could
923 cause new probes to be immediately
926 if (sr->probe_cancel_task != GNUNET_SCHEDULER_NO_TASK)
928 GNUNET_SCHEDULER_cancel (h->sched,
929 sr->probe_cancel_task);
937 * Stop search for content.
939 * @param sc context for the search that should be stopped
942 GNUNET_FS_search_stop (struct GNUNET_FS_SearchContext *sc)
944 struct GNUNET_FS_ProgressInfo pi;
947 // FIXME: make un-persistent!
948 if (NULL != sc->parent)
950 // FIXME: need to untrack sc
953 GNUNET_CONTAINER_multihashmap_iterate (sc->master_result_map,
956 pi.status = GNUNET_FS_STATUS_SEARCH_STOPPED;
957 make_search_status (&pi, sc);
958 sc->client_info = sc->h->upcb (sc->h->upcb_cls,
960 GNUNET_break (NULL == sc->client_info);
961 if (sc->task != GNUNET_SCHEDULER_NO_TASK)
962 GNUNET_SCHEDULER_cancel (sc->h->sched,
964 if (NULL != sc->client)
965 GNUNET_CLIENT_disconnect (sc->client);
966 GNUNET_CONTAINER_multihashmap_destroy (sc->master_result_map);
967 for (i=0;i<sc->uri->data.ksk.keywordCount;i++)
968 GNUNET_CONTAINER_multihashmap_destroy (sc->requests[i].results);
969 GNUNET_free_non_null (sc->requests);
970 GNUNET_FS_uri_destroy (sc->uri);
974 /* end of fs_search.c */