diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-05-02 02:22:07 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-05-02 02:22:07 +0200 |
commit | 358182c512f94961faadfde9911f2b7977bc8c29 (patch) | |
tree | aee0b26cf612120f330e5b64d9abe9d74560d46f | |
parent | fb7e96e9cc1fcf2a78cec4fa216954e7d83670a9 (diff) | |
download | merchant-358182c512f94961faadfde9911f2b7977bc8c29.tar.gz merchant-358182c512f94961faadfde9911f2b7977bc8c29.tar.bz2 merchant-358182c512f94961faadfde9911f2b7977bc8c29.zip |
fixing #4479 for merchant
-rw-r--r-- | src/backend/taler-merchant-httpd_exchanges.c | 13 | ||||
-rw-r--r-- | src/lib/test_merchant_api.c | 39 |
2 files changed, 23 insertions, 29 deletions
diff --git a/src/backend/taler-merchant-httpd_exchanges.c b/src/backend/taler-merchant-httpd_exchanges.c index 044877ce..03a243d8 100644 --- a/src/backend/taler-merchant-httpd_exchanges.c +++ b/src/backend/taler-merchant-httpd_exchanges.c @@ -234,16 +234,17 @@ keys_mgmt_cb (void *cls, /** * Restart the task that pumps events into curl * with updated file descriptors. + * + * @param cls NULL */ static void -merchant_curl_refresh () +merchant_curl_refresh (void *cls) { if (NULL != merchant_curl_task) { GNUNET_SCHEDULER_cancel (merchant_curl_task); merchant_curl_task = NULL; } - merchant_curl_task = GNUNET_SCHEDULER_add_now (&merchant_curl_cb, NULL); } @@ -332,7 +333,6 @@ return_result (void *cls) (GNUNET_SYSERR == exchange->pending) ? NULL : exchange->conn, exchange->trusted); GNUNET_free (fo); - merchant_curl_refresh (); } @@ -341,7 +341,7 @@ return_result (void *cls) * the closure. * * @param cls the exchange - * + * */ static void retry_exchange (void *cls) @@ -358,7 +358,6 @@ retry_exchange (void *cls) exchange, TALER_EXCHANGE_OPTION_END); GNUNET_break (NULL != exchange->conn); - merchant_curl_refresh (); } @@ -576,7 +575,8 @@ TMH_EXCHANGES_init (const struct GNUNET_CONFIGURATION_Handle *cfg) struct Exchange *exchange; json_t *j_exchange; - merchant_curl_ctx = GNUNET_CURL_init (); + merchant_curl_ctx = GNUNET_CURL_init (&merchant_curl_refresh, + NULL); if (NULL == merchant_curl_ctx) { GNUNET_break (0); @@ -598,7 +598,6 @@ TMH_EXCHANGES_init (const struct GNUNET_CONFIGURATION_Handle *cfg) json_array_append_new (trusted_exchanges, j_exchange); } - merchant_curl_refresh (); return GNUNET_OK; } diff --git a/src/lib/test_merchant_api.c b/src/lib/test_merchant_api.c index 246d8af7..9ef911e7 100644 --- a/src/lib/test_merchant_api.c +++ b/src/lib/test_merchant_api.c @@ -392,27 +392,6 @@ struct InterpreterState /** - * Task that runs the context's event loop with the GNUnet scheduler. - * - * @param cls unused - */ -static void -context_task (void *cls); - - -/** - * Run the context task, the working set has changed. - */ -static void -trigger_context_task () -{ - GNUNET_SCHEDULER_cancel (ctx_task); - ctx_task = GNUNET_SCHEDULER_add_now (&context_task, - NULL); -} - - -/** * The testcase failed, return with an error code. * * @param is interpreter state to clean up @@ -1370,6 +1349,21 @@ context_task (void *cls) /** + * Run the context task, the working set has changed. + * + * @param cls NULL + */ +static void +trigger_context_task (void *cls) +{ + if (NULL != ctx_task) + GNUNET_SCHEDULER_cancel (ctx_task); + ctx_task = GNUNET_SCHEDULER_add_now (&context_task, + NULL); +} + + +/** * Main function that will be run by the scheduler. * * @param cls closure @@ -1459,7 +1453,8 @@ run (void *cls) is = GNUNET_new (struct InterpreterState); is->commands = commands; - ctx = GNUNET_CURL_init (); + ctx = GNUNET_CURL_init (&trigger_context_task, + NULL); GNUNET_assert (NULL != ctx); ctx_task = GNUNET_SCHEDULER_add_now (&context_task, ctx); |