From 09c1cfcf599406c01456d310841748493ebe2e73 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 25 Oct 2009 19:36:38 +0000 Subject: [PATCH] API fix --- src/fs/fs_search.c | 12 ++++++++++-- src/fs/gnunet-search.c | 3 ++- src/fs/test_fs_namespace.c | 2 +- src/fs/test_fs_search.c | 5 +++-- src/include/gnunet_fs_service.h | 5 +++-- 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/fs/fs_search.c b/src/fs/fs_search.c index 94b8b2082..8b986ec7c 100644 --- a/src/fs/fs_search.c +++ b/src/fs/fs_search.c @@ -268,6 +268,7 @@ process_ksk_result (struct GNUNET_FS_SearchContext *sc, * @param uri specifies the search parameters; can be * a KSK URI or an SKS URI. * @param anonymity desired level of anonymity + * @param cctx client context * @param parent parent search (for namespace update searches) * @return context that can be used to control the search */ @@ -275,6 +276,7 @@ static struct GNUNET_FS_SearchContext * search_start (struct GNUNET_FS_Handle *h, const struct GNUNET_FS_Uri *uri, uint32_t anonymity, + void *cctx, struct GNUNET_FS_SearchContext *parent); @@ -336,6 +338,7 @@ process_sks_result (struct GNUNET_FS_SearchContext *sc, search_start (sc->h, &uu, sc->anonymity, + NULL, sc); } @@ -733,6 +736,7 @@ try_reconnect (struct GNUNET_FS_SearchContext *sc) * @param uri specifies the search parameters; can be * a KSK URI or an SKS URI. * @param anonymity desired level of anonymity + * @param cctx initial value for the client context * @param parent parent search (for namespace update searches) * @return context that can be used to control the search */ @@ -740,6 +744,7 @@ static struct GNUNET_FS_SearchContext * search_start (struct GNUNET_FS_Handle *h, const struct GNUNET_FS_Uri *uri, uint32_t anonymity, + void *cctx, struct GNUNET_FS_SearchContext *parent) { struct GNUNET_FS_SearchContext *sc; @@ -780,6 +785,7 @@ search_start (struct GNUNET_FS_Handle *h, sc->client = client; sc->parent = parent; sc->master_result_map = GNUNET_CONTAINER_multihashmap_create (16); + sc->client_info = cctx; sc->requests = GNUNET_malloc (sizeof (struct SearchRequestEntry) * sc->uri->data.ksk.keywordCount); @@ -827,14 +833,16 @@ search_start (struct GNUNET_FS_Handle *h, * @param uri specifies the search parameters; can be * a KSK URI or an SKS URI. * @param anonymity desired level of anonymity + * @param cctx initial value for the client context * @return context that can be used to control the search */ struct GNUNET_FS_SearchContext * GNUNET_FS_search_start (struct GNUNET_FS_Handle *h, const struct GNUNET_FS_Uri *uri, - uint32_t anonymity) + uint32_t anonymity, + void *cctx) { - return search_start (h, uri, anonymity, NULL); + return search_start (h, uri, anonymity, cctx, NULL); } diff --git a/src/fs/gnunet-search.c b/src/fs/gnunet-search.c index ed864fa1c..067d77159 100644 --- a/src/fs/gnunet-search.c +++ b/src/fs/gnunet-search.c @@ -179,7 +179,8 @@ run (void *cls, } sc = GNUNET_FS_search_start (ctx, uri, - anonymity); + anonymity, + NULL); GNUNET_FS_uri_destroy (uri); if (NULL == sc) { diff --git a/src/fs/test_fs_namespace.c b/src/fs/test_fs_namespace.c index 04e82c5d7..7a1a6f81e 100644 --- a/src/fs/test_fs_namespace.c +++ b/src/fs/test_fs_namespace.c @@ -108,7 +108,7 @@ publish_cont (void *cls, GNUNET_assert (NULL == emsg); fprintf (stderr, "Starting namespace search...\n"); - search = GNUNET_FS_search_start (fs, uri, 1); + search = GNUNET_FS_search_start (fs, uri, 1, "ns-search"); } diff --git a/src/fs/test_fs_search.c b/src/fs/test_fs_search.c index 01bb3c1f7..d1b5f77aa 100644 --- a/src/fs/test_fs_search.c +++ b/src/fs/test_fs_search.c @@ -114,7 +114,8 @@ progress_cb (void *cls, start = GNUNET_TIME_absolute_get (); search = GNUNET_FS_search_start (fs, kuri, - 1); + 1, + "search"); GNUNET_FS_uri_destroy (kuri); GNUNET_assert (search != NULL); break; @@ -165,7 +166,7 @@ progress_cb (void *cls, break; case GNUNET_FS_STATUS_SEARCH_START: GNUNET_assert (search == NULL); - // GNUNET_assert (0 == strcmp ("search", event->value.search.cctx)); + GNUNET_assert (0 == strcmp ("search", event->value.search.cctx)); GNUNET_assert (1 == event->value.search.anonymity); break; case GNUNET_FS_STATUS_SEARCH_RESULT_STOPPED: diff --git a/src/include/gnunet_fs_service.h b/src/include/gnunet_fs_service.h index 6ce4b6d11..cfba8ccba 100644 --- a/src/include/gnunet_fs_service.h +++ b/src/include/gnunet_fs_service.h @@ -2153,13 +2153,14 @@ GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Namespace *namespace, * @param uri specifies the search parameters; can be * a KSK URI or an SKS URI. * @param anonymity desired level of anonymity + * @param cctx initial value for the client context * @return context that can be used to control the search */ -// FIXME: add a "void *" context for the client to arguments!? struct GNUNET_FS_SearchContext * GNUNET_FS_search_start (struct GNUNET_FS_Handle *h, const struct GNUNET_FS_Uri *uri, - uint32_t anonymity); + uint32_t anonymity, + void *cctx); /** -- 2.25.1