From 2a2708dde105c46cee19dd09ee792da2e6c93f8f Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 7 Dec 2014 21:23:24 +0000 Subject: fixing #3568 --- src/fs/gnunet-service-fs.c | 11 +++-------- src/fs/gnunet-service-fs_lc.c | 8 +++++--- src/fs/gnunet-service-fs_pr.c | 24 +++++++++++++++++++++++- 3 files changed, 31 insertions(+), 12 deletions(-) diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index b824e6dc6..6652ecb16 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c @@ -400,18 +400,13 @@ start_p2p_processing (void *cls, struct GSF_PendingRequest *pr, struct GNUNET_SERVER_Client *client = cls; struct GSF_PendingRequestData *prd; + GNUNET_SERVER_receive_done (client, GNUNET_OK); + if (GNUNET_BLOCK_EVALUATION_OK_LAST == result) + return; /* we're done, 'pr' was already destroyed... */ prd = GSF_pending_request_get_data_ (pr); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Finished database lookup for local request `%s' with result %d\n", GNUNET_h2s (&prd->query), result); - GNUNET_SERVER_receive_done (client, GNUNET_OK); - if (GNUNET_BLOCK_EVALUATION_OK_LAST == result) - return; /* we're done, 'pr' was already destroyed... */ - if (0 != (GSF_PRO_LOCAL_ONLY & prd->options)) - { - GSF_pending_request_cancel_ (pr, GNUNET_YES); - return; - } if (0 == prd->anonymity_level) { switch (prd->type) diff --git a/src/fs/gnunet-service-fs_lc.c b/src/fs/gnunet-service-fs_lc.c index 0f1d69198..ef30ba32a 100644 --- a/src/fs/gnunet-service-fs_lc.c +++ b/src/fs/gnunet-service-fs_lc.c @@ -221,7 +221,7 @@ client_request_destroy (void *cls, * @param last_transmission when was the last time we've tried to download this block? (FOREVER if unknown) * @param type type of the block * @param data response data, NULL on request expiration - * @param data_len number of bytes in data + * @param data_len number of bytes in @e data */ static void client_response_handler (void *cls, enum GNUNET_BLOCK_EvaluationResult eval, @@ -240,8 +240,10 @@ client_response_handler (void *cls, enum GNUNET_BLOCK_EvaluationResult eval, if (NULL == data) { - /* ugh, request 'timed out' -- how can this be? */ - GNUNET_break (0); + /* local-only request, with no result, clean up. */ + if (GNUNET_SCHEDULER_NO_TASK == cr->kill_task) + cr->kill_task = GNUNET_SCHEDULER_add_now (&client_request_destroy, + cr); return; } prd = GSF_pending_request_get_data_ (pr); diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c index 67c935acd..a9530f53a 100644 --- a/src/fs/gnunet-service-fs_pr.c +++ b/src/fs/gnunet-service-fs_pr.c @@ -128,7 +128,7 @@ struct GSF_PendingRequest GSF_LocalLookupContinuation llc_cont; /** - * Closure for llc_cont. + * Closure for @e llc_cont. */ void *llc_cont_cls; @@ -1514,6 +1514,28 @@ check_error_and_continue: if (NULL == (cont = pr->llc_cont)) return; /* no continuation */ pr->llc_cont = NULL; + if (0 != (GSF_PRO_LOCAL_ONLY & pr->public_data.options)) + { + if (GNUNET_BLOCK_EVALUATION_OK_LAST != pr->local_result) + { + /* Signal that we are done and that there won't be any + additional results to allow client to clean up state. */ + pr->rh (pr->rh_cls, + GNUNET_BLOCK_EVALUATION_OK_LAST, + pr, + UINT32_MAX, + GNUNET_TIME_UNIT_ZERO_ABS, + GNUNET_TIME_UNIT_FOREVER_ABS, + GNUNET_BLOCK_TYPE_ANY, + NULL, 0); + } + /* Finally, call our continuation to signal that we are + done with local processing of this request; i.e. to + start reading again from the client. */ + cont (pr->llc_cont_cls, NULL, GNUNET_BLOCK_EVALUATION_OK_LAST); + return; + } + cont (pr->llc_cont_cls, pr, pr->local_result); } -- cgit v1.2.3