From 390a68296dd89f61461bdca02060d36e2e02af2b Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 25 Mar 2011 08:49:47 +0000 Subject: [PATCH] adapt to new API --- src/fs/gnunet-service-fs.c | 18 +++++------ src/fs/gnunet-service-fs_cp.c | 7 +---- src/fs/gnunet-service-fs_lc.c | 20 +------------ src/fs/gnunet-service-fs_pr.c | 53 ++++++++++++--------------------- src/fs/gnunet-service-fs_pr.h | 6 +--- src/fs/gnunet-service-fs_push.c | 6 ++-- src/fs/gnunet-service-fs_put.c | 2 +- 7 files changed, 35 insertions(+), 77 deletions(-) diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index ab16bc834..687f131d1 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c @@ -1297,7 +1297,7 @@ process_migration_content (void *cls, MIN_MIGRATION_CONTENT_LIFETIME.rel_value) { /* content will expire soon, don't bother */ - GNUNET_DATASTORE_get_next (dsh, GNUNET_YES); + GNUNET_DATASTORE_get_next (dsh); return; } if (type == GNUNET_BLOCK_TYPE_FS_ONDEMAND) @@ -1309,7 +1309,7 @@ process_migration_content (void *cls, &process_migration_content, NULL)) { - GNUNET_DATASTORE_get_next (dsh, GNUNET_YES); + GNUNET_DATASTORE_get_next (dsh); } return; } @@ -1333,7 +1333,7 @@ process_migration_content (void *cls, GNUNET_CONTAINER_multihashmap_iterate (connected_peers, &consider_migration, mb); - GNUNET_DATASTORE_get_next (dsh, GNUNET_YES); + GNUNET_DATASTORE_get_next (dsh); } @@ -1344,7 +1344,7 @@ static void dht_put_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - GNUNET_DATASTORE_get_next (dsh, GNUNET_YES); + GNUNET_DATASTORE_get_next (dsh); } @@ -3984,7 +3984,7 @@ process_local_reply (void *cls, pr)) if (pr->qe != NULL) { - GNUNET_DATASTORE_get_next (dsh, GNUNET_YES); + GNUNET_DATASTORE_get_next (dsh); } return; } @@ -4007,7 +4007,7 @@ process_local_reply (void *cls, -1, -1, GNUNET_TIME_UNIT_FOREVER_REL, NULL, NULL); - GNUNET_DATASTORE_get_next (dsh, GNUNET_YES); + GNUNET_DATASTORE_get_next (dsh); return; } prq.type = type; @@ -4026,7 +4026,7 @@ process_local_reply (void *cls, if (prq.eval == GNUNET_BLOCK_EVALUATION_OK_LAST) { pr->local_only = GNUNET_YES; /* do not forward */ - GNUNET_DATASTORE_get_next (dsh, GNUNET_NO); + GNUNET_DATASTORE_get_next (dsh); return; } if ( (pr->client_request_list == NULL) && @@ -4041,10 +4041,10 @@ process_local_reply (void *cls, gettext_noop ("# processing result set cut short due to load"), 1, GNUNET_NO); - GNUNET_DATASTORE_get_next (dsh, GNUNET_NO); + GNUNET_DATASTORE_get_next (dsh); return; } - GNUNET_DATASTORE_get_next (dsh, GNUNET_YES); + GNUNET_DATASTORE_get_next (dsh); } diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c index c4e82350f..9ff96ba36 100644 --- a/src/fs/gnunet-service-fs_cp.c +++ b/src/fs/gnunet-service-fs_cp.c @@ -562,17 +562,13 @@ copy_reply (void *cls, * @param expiration when does 'data' expire? * @param data response data, NULL on request expiration * @param data_len number of bytes in data - * @param more GNUNET_YES if the request remains active (may call - * this function again), GNUNET_NO if the request is - * finished (client must not call GSF_pending_request_cancel_) */ static void handle_p2p_reply (void *cls, struct GSF_PendingRequest *pr, struct GNUNET_TIME_Absolute expiration, const void *data, - size_t data_len, - int more) + size_t data_len) { struct GSF_ConnectedPeer *cp = cls; struct GSF_PendingRequestData *prd; @@ -582,7 +578,6 @@ handle_p2p_reply (void *cls, prd = GSF_pending_request_get_data_ (pr); if (NULL == data) { - GNUNET_assert (GNUNET_NO == more); GNUNET_STATISTICS_update (GSF_stats, gettext_noop ("# P2P searches active"), -1, diff --git a/src/fs/gnunet-service-fs_lc.c b/src/fs/gnunet-service-fs_lc.c index 8727670e8..5ceb7c2a5 100644 --- a/src/fs/gnunet-service-fs_lc.c +++ b/src/fs/gnunet-service-fs_lc.c @@ -192,17 +192,13 @@ GSF_local_client_lookup_ (struct GNUNET_SERVER_Client *client) * @param expiration when does 'data' expire? * @param data response data, NULL on request expiration * @param data_len number of bytes in data - * @param more GNUNET_YES if the request remains active (may call - * this function again), GNUNET_NO if the request is - * finished (client must not call GSF_pending_request_cancel_) */ static void client_response_handler (void *cls, struct GSF_PendingRequest *pr, struct GNUNET_TIME_Absolute expiration, const void *data, - size_t data_len, - int more) + size_t data_len) { struct ClientRequest *cr = cls; struct GSF_LocalClient *lc; @@ -214,7 +210,6 @@ client_response_handler (void *cls, { /* ugh, request 'timed out' -- how can this be? */ GNUNET_break (0); - GNUNET_assert (GNUNET_NO == more); return; } GNUNET_STATISTICS_update (GSF_stats, @@ -238,19 +233,6 @@ client_response_handler (void *cls, GNUNET_h2s (&prd->query), (unsigned int) prd->type); #endif - if (GNUNET_NO == more) - { - GNUNET_CONTAINER_DLL_remove (lc->cr_head, - lc->cr_tail, - cr); - GNUNET_SERVER_receive_done (lc->client, - GNUNET_OK); - GNUNET_STATISTICS_update (GSF_stats, - gettext_noop ("# client searches active"), - - 1, - GNUNET_NO); - GNUNET_free (cr); - } } diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c index c3116ba23..13de31c7c 100644 --- a/src/fs/gnunet-service-fs_pr.c +++ b/src/fs/gnunet-service-fs_pr.c @@ -333,8 +333,7 @@ GSF_pending_request_create_ (enum GSF_PendingRequestOptions options, dpr->rh (dpr->rh_cls, dpr, GNUNET_TIME_UNIT_FOREVER_ABS, - NULL, 0, - GNUNET_SYSERR); + NULL, 0); GSF_pending_request_cancel_ (dpr); } } @@ -617,11 +616,6 @@ struct ProcessReplyClosure */ enum GNUNET_BLOCK_EvaluationResult eval; - /** - * Did we finish processing the associated request? - */ - int finished; - /** * Did we find a matching request? */ @@ -698,11 +692,7 @@ process_reply (void *cls, pr->rh (pr->rh_cls, pr, prq->expiration, - prq->data, prq->size, - GNUNET_NO); - /* destroy request, we're done */ - prq->finished = GNUNET_YES; - GSF_pending_request_cancel_ (pr); + prq->data, prq->size); return GNUNET_YES; case GNUNET_BLOCK_EVALUATION_OK_DUPLICATE: GNUNET_STATISTICS_update (GSF_stats, @@ -759,8 +749,7 @@ process_reply (void *cls, pr->rh (pr->rh_cls, pr, prq->expiration, - prq->data, prq->size, - GNUNET_YES); + prq->data, prq->size); return GNUNET_YES; } @@ -958,13 +947,16 @@ process_local_reply (void *cls, { struct GSF_PendingRequest *pr = cls; GSF_LocalLookupContinuation cont; - struct ProcessReplyClosure prq; GNUNET_HashCode query; unsigned int old_rf; if (NULL == key) { +#if DEBUG_FS + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "No further local repsonses available.\n"); +#endif pr->qe = NULL; if (NULL != (cont = pr->llc_cont)) { @@ -998,7 +990,7 @@ process_local_reply (void *cls, pr)) { if (pr->qe != NULL) - GNUNET_DATASTORE_get_next (GSF_dsh, GNUNET_YES); + GNUNET_DATASTORE_get_next (GSF_dsh); } return; } @@ -1021,26 +1013,17 @@ process_local_reply (void *cls, -1, -1, GNUNET_TIME_UNIT_FOREVER_REL, NULL, NULL); - GNUNET_DATASTORE_get_next (GSF_dsh, GNUNET_YES); + GNUNET_DATASTORE_get_next (GSF_dsh); return; } prq.type = type; prq.priority = priority; - prq.finished = GNUNET_NO; prq.request_found = GNUNET_NO; prq.anonymity_level = anonymity; if ( (old_rf == 0) && (pr->public_data.results_found == 0) ) GSF_update_datastore_delay_ (pr->public_data.start_time); process_reply (&prq, key, pr); - if (prq.finished == GNUNET_YES) - { -#if DEBUG_FS - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Request processing finished, not asking datastore for more\n"); -#endif - return; - } pr->local_result = prq.eval; if (pr->qe == NULL) { @@ -1049,11 +1032,6 @@ process_local_reply (void *cls, "Request cancelled, not asking datastore for more\n"); #endif } - if (prq.eval == GNUNET_BLOCK_EVALUATION_OK_LAST) - { - GNUNET_DATASTORE_get_next (GSF_dsh, GNUNET_NO); - return; - } if ( (0 == (GSF_PRO_PRIORITY_UNLIMITED & pr->public_data.options)) && ( (GNUNET_YES == GSF_test_get_load_too_high_ (0)) || (pr->public_data.results_found > 5 + 2 * pr->public_data.priority) ) ) @@ -1066,10 +1044,18 @@ process_local_reply (void *cls, gettext_noop ("# processing result set cut short due to load"), 1, GNUNET_NO); - GNUNET_DATASTORE_get_next (GSF_dsh, GNUNET_NO); + GNUNET_DATASTORE_cancel (pr->qe); + pr->qe = NULL; + if (NULL != (cont = pr->llc_cont)) + { + pr->llc_cont = NULL; + cont (pr->llc_cont_cls, + pr, + pr->local_result); + } return; } - GNUNET_DATASTORE_get_next (GSF_dsh, GNUNET_YES); + GNUNET_DATASTORE_get_next (GSF_dsh); } @@ -1162,7 +1148,6 @@ GSF_handle_p2p_content_ (struct GSF_ConnectedPeer *cp, prq.expiration = expiration; prq.priority = 0; prq.anonymity_level = 1; - prq.finished = GNUNET_NO; prq.request_found = GNUNET_NO; GNUNET_CONTAINER_multihashmap_get_multiple (pr_map, &query, diff --git a/src/fs/gnunet-service-fs_pr.h b/src/fs/gnunet-service-fs_pr.h index a25659e22..ea464e578 100644 --- a/src/fs/gnunet-service-fs_pr.h +++ b/src/fs/gnunet-service-fs_pr.h @@ -162,16 +162,12 @@ struct GSF_PendingRequestData * @param expiration when does 'data' expire? * @param data response data, NULL on request expiration * @param data_len number of bytes in data - * @param more GNUNET_YES if the request remains active (may call - * this function again), GNUNET_NO if the request is - * finished (client must not call GSF_pending_request_cancel_) */ typedef void (*GSF_PendingRequestReplyHandler)(void *cls, struct GSF_PendingRequest *pr, struct GNUNET_TIME_Absolute expiration, const void *data, - size_t data_len, - int more); + size_t data_len); /** diff --git a/src/fs/gnunet-service-fs_push.c b/src/fs/gnunet-service-fs_push.c index da781bc07..e720f392f 100644 --- a/src/fs/gnunet-service-fs_push.c +++ b/src/fs/gnunet-service-fs_push.c @@ -479,7 +479,7 @@ process_migration_content (void *cls, MIN_MIGRATION_CONTENT_LIFETIME.rel_value) { /* content will expire soon, don't bother */ - GNUNET_DATASTORE_get_next (GSF_dsh, GNUNET_YES); + GNUNET_DATASTORE_get_next (GSF_dsh); return; } if (type == GNUNET_BLOCK_TYPE_FS_ONDEMAND) @@ -491,7 +491,7 @@ process_migration_content (void *cls, &process_migration_content, NULL)) { - GNUNET_DATASTORE_get_next (GSF_dsh, GNUNET_YES); + GNUNET_DATASTORE_get_next (GSF_dsh); } return; } @@ -522,7 +522,7 @@ process_migration_content (void *cls, } pos = pos->next; } - GNUNET_DATASTORE_get_next (GSF_dsh, GNUNET_YES); + GNUNET_DATASTORE_get_next (GSF_dsh); } diff --git a/src/fs/gnunet-service-fs_put.c b/src/fs/gnunet-service-fs_put.c index 97a7a90b5..5fd2ce81c 100644 --- a/src/fs/gnunet-service-fs_put.c +++ b/src/fs/gnunet-service-fs_put.c @@ -109,7 +109,7 @@ static void dht_put_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - GNUNET_DATASTORE_get_next (GSF_dsh, GNUNET_YES); + GNUNET_DATASTORE_get_next (GSF_dsh); } -- 2.25.1