gnunet

Main GNUnet Logic
Log | Files | Refs | Submodules | README | LICENSE

commit ae82c19b277ae3f5f43379ed6fc384aba4fdea83
parent a567f15a1d1c9c8bd17135a120df44da2b85cd8a
Author: Christian Grothoff <christian@grothoff.org>
Date:   Thu, 22 Nov 2018 16:27:34 +0100

simplify peerstore API

Diffstat:
Mdoc/tutorial/examples/014.c | 1-
Msrc/fs/gnunet-service-fs_cp.c | 1-
Msrc/include/gnunet_peerstore_service.h | 2--
Msrc/peerstore/peerstore_api.c | 53-----------------------------------------------------
Msrc/peerstore/test_peerstore_api_iterate.c | 5+----
Msrc/peerstore/test_peerstore_api_store.c | 6++----
Msrc/peerstore/test_peerstore_api_sync.c | 4++--
7 files changed, 5 insertions(+), 67 deletions(-)

diff --git a/doc/tutorial/examples/014.c b/doc/tutorial/examples/014.c @@ -3,7 +3,6 @@ GNUNET_PEERSTORE_iterate (struct GNUNET_PEERSTORE_Handle *h, const char *sub_system, const struct GNUNET_PeerIdentity *peer, const char *key, - struct GNUNET_TIME_Relative timeout, GNUNET_PEERSTORE_Processor callback, void *callback_cls); diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c @@ -618,7 +618,6 @@ GSF_peer_connect_handler (void *cls, "fs", peer, "respect", - GNUNET_TIME_UNIT_FOREVER_REL, &peer_respect_cb, cp); GSF_iterate_pending_requests_ (&consider_peer_for_forwarding, diff --git a/src/include/gnunet_peerstore_service.h b/src/include/gnunet_peerstore_service.h @@ -205,7 +205,6 @@ GNUNET_PEERSTORE_store_cancel (struct GNUNET_PEERSTORE_StoreContext *sc); * @param sub_system name of sub system * @param peer Peer identity (can be NULL) * @param key entry key string (can be NULL) - * @param timeout time after which the iterate request is canceled * @param callback function called with each matching record, all NULL's on end * @param callback_cls closure for @a callback */ @@ -214,7 +213,6 @@ GNUNET_PEERSTORE_iterate (struct GNUNET_PEERSTORE_Handle *h, const char *sub_system, const struct GNUNET_PeerIdentity *peer, const char *key, - struct GNUNET_TIME_Relative timeout, GNUNET_PEERSTORE_Processor callback, void *callback_cls); diff --git a/src/peerstore/peerstore_api.c b/src/peerstore/peerstore_api.c @@ -183,11 +183,6 @@ struct GNUNET_PEERSTORE_IterateContext char *key; /** - * Operation timeout - */ - struct GNUNET_TIME_Relative timeout; - - /** * Callback with each matching record */ GNUNET_PEERSTORE_Processor callback; @@ -202,12 +197,6 @@ struct GNUNET_PEERSTORE_IterateContext */ int iterating; - /** - * Task identifier for the function called - * on iterate request timeout - */ - struct GNUNET_SCHEDULER_Task *timeout_task; - }; /** @@ -327,29 +316,6 @@ rewatch_it (void *cls, /** - * Called when the iterate request is timedout - * - * @param cls a `struct GNUNET_PEERSTORE_IterateContext *` - */ -static void -iterate_timeout (void *cls) -{ - struct GNUNET_PEERSTORE_IterateContext *ic = cls; - GNUNET_PEERSTORE_Processor callback; - void *callback_cls; - - ic->timeout_task = NULL; - callback = ic->callback; - callback_cls = ic->callback_cls; - GNUNET_PEERSTORE_iterate_cancel (ic); - if (NULL != callback) - callback (callback_cls, - NULL, - _("timeout")); -} - - -/** * Iterator over watch requests to cancel them. * * @param cls unsused @@ -645,11 +611,6 @@ handle_iterate_result (void *cls, void GNUNET_PEERSTORE_iterate_cancel (struct GNUNET_PEERSTORE_IterateContext *ic) { - if (NULL != ic->timeout_task) - { - GNUNET_SCHEDULER_cancel (ic->timeout_task); - ic->timeout_task = NULL; - } if (GNUNET_NO == ic->iterating) { GNUNET_CONTAINER_DLL_remove (ic->h->iterate_head, @@ -671,7 +632,6 @@ GNUNET_PEERSTORE_iterate_cancel (struct GNUNET_PEERSTORE_IterateContext *ic) * @param sub_system name of sub system * @param peer Peer identity (can be NULL) * @param key entry key string (can be NULL) - * @param timeout time after which the iterate request is canceled * @param callback function called with each matching record, all NULL's on end * @param callback_cls closure for @a callback * @return Handle to iteration request @@ -681,7 +641,6 @@ GNUNET_PEERSTORE_iterate (struct GNUNET_PEERSTORE_Handle *h, const char *sub_system, const struct GNUNET_PeerIdentity *peer, const char *key, - struct GNUNET_TIME_Relative timeout, GNUNET_PEERSTORE_Processor callback, void *callback_cls) { @@ -696,7 +655,6 @@ GNUNET_PEERSTORE_iterate (struct GNUNET_PEERSTORE_Handle *h, 0, GNUNET_MESSAGE_TYPE_PEERSTORE_ITERATE); ic = GNUNET_new (struct GNUNET_PEERSTORE_IterateContext); - ic->callback = callback; ic->callback_cls = callback_cls; ic->h = h; @@ -705,7 +663,6 @@ GNUNET_PEERSTORE_iterate (struct GNUNET_PEERSTORE_Handle *h, ic->peer = *peer; if (NULL != key) ic->key = GNUNET_strdup (key); - ic->timeout = timeout; GNUNET_CONTAINER_DLL_insert_tail (h->iterate_head, h->iterate_tail, ic); @@ -713,10 +670,6 @@ GNUNET_PEERSTORE_iterate (struct GNUNET_PEERSTORE_Handle *h, "Sending an iterate request for sub system `%s'\n", sub_system); GNUNET_MQ_send (h->mq, ev); - ic->timeout_task = - GNUNET_SCHEDULER_add_delayed (timeout, - &iterate_timeout, - ic); return ic; } @@ -860,12 +813,6 @@ reconnect (struct GNUNET_PEERSTORE_Handle *h) 0, GNUNET_MESSAGE_TYPE_PEERSTORE_ITERATE); GNUNET_MQ_send (h->mq, ev); - if (NULL != ic->timeout_task) - GNUNET_SCHEDULER_cancel (ic->timeout_task); - ic->timeout_task - = GNUNET_SCHEDULER_add_delayed (ic->timeout, - &iterate_timeout, - ic); } for (sc = h->store_head; NULL != sc; sc = sc->next) { diff --git a/src/peerstore/test_peerstore_api_iterate.c b/src/peerstore/test_peerstore_api_iterate.c @@ -82,7 +82,6 @@ iter2_cb (void *cls, ss, NULL, NULL, - GNUNET_TIME_UNIT_FOREVER_REL, &iter3_cb, NULL); } @@ -109,8 +108,7 @@ iter1_cb (void *cls, ss, &p1, NULL, - GNUNET_TIME_UNIT_FOREVER_REL, - iter2_cb, + &iter2_cb, NULL); } @@ -158,7 +156,6 @@ run (void *cls, ss, &p1, k1, - GNUNET_TIME_UNIT_FOREVER_REL, &iter1_cb, NULL); } diff --git a/src/peerstore/test_peerstore_api_store.c b/src/peerstore/test_peerstore_api_store.c @@ -71,7 +71,6 @@ test3_cont (void *cls, subsystem, &pid, key, - GNUNET_TIME_UNIT_SECONDS, &test3_cont2, NULL); } @@ -127,8 +126,8 @@ test2_cont (void *cls, int success) GNUNET_PEERSTORE_iterate (h, subsystem, &pid, key, - GNUNET_TIME_UNIT_SECONDS, - &test2_cont2, NULL); + &test2_cont2, + NULL); } @@ -181,7 +180,6 @@ test1_cont (void *cls, int success) subsystem, &pid, key, - GNUNET_TIME_UNIT_SECONDS, &test1_cont2, NULL); } diff --git a/src/peerstore/test_peerstore_api_sync.c b/src/peerstore/test_peerstore_api_sync.c @@ -111,8 +111,8 @@ test_cont (void *cls) GNUNET_PEERSTORE_iterate (h, subsystem, &pid, key, - GNUNET_TIME_UNIT_FOREVER_REL, - &iterate_cb, NULL); + &iterate_cb, + NULL); }