From 220ce20d05496c6d64127c2c584ea3f01418fbf9 Mon Sep 17 00:00:00 2001 From: Marcello Stanisci Date: Fri, 25 Jan 2019 15:57:27 +0100 Subject: Revert explicit AUDITOR_connect at tests. --- src/include/taler_testing_lib.h | 6 ++++++ src/lib/exchange_api_handle.c | 7 ++++--- src/lib/testing_auditor_api_helpers.c | 32 +++++++++++++++++++++++++++++++- 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h index 6573d2cd7..711a13235 100644 --- a/src/include/taler_testing_lib.h +++ b/src/include/taler_testing_lib.h @@ -369,6 +369,12 @@ struct TALER_TESTING_Interpreter */ int working; + /** + * Is the auditor running (#GNUNET_YES) or waiting + * for /version (#GNUNET_NO)? + */ + int auditor_working; + /** * How often have we gotten a /keys response so far? */ diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c index 4af5bdf64..d6255c54f 100644 --- a/src/lib/exchange_api_handle.c +++ b/src/lib/exchange_api_handle.c @@ -645,9 +645,10 @@ parse_json_auditor (struct TALER_EXCHANGE_AuditorInformation *auditor, * @param compat protocol compatibility information */ static void -auditor_version_cb (void *cls, - const struct TALER_AUDITOR_VersionInformation *vi, - enum TALER_AUDITOR_VersionCompatibility compat) +auditor_version_cb + (void *cls, + const struct TALER_AUDITOR_VersionInformation *vi, + enum TALER_AUDITOR_VersionCompatibility compat) { struct TEAH_AuditorListEntry *ale = cls; diff --git a/src/lib/testing_auditor_api_helpers.c b/src/lib/testing_auditor_api_helpers.c index c85fe47b7..fd9de3537 100644 --- a/src/lib/testing_auditor_api_helpers.c +++ b/src/lib/testing_auditor_api_helpers.c @@ -98,6 +98,25 @@ struct MainWrapperContext }; +/** + * Function called with information about the auditor. + * + * @param cls closure + * @param vi basic information about the auditor + * @param compat protocol compatibility information + */ +static void +auditor_version_cb + (void *cls, + const struct TALER_AUDITOR_VersionInformation *vi, + enum TALER_AUDITOR_VersionCompatibility compat) +{ + struct TALER_TESTING_Interpreter *is = cls; + + /* TODO: check vi/compat? */ + is->auditor_working = GNUNET_YES; +} + /** * Setup the @a is 'auditor' member before running the main test loop. * @@ -124,12 +143,23 @@ auditor_main_wrapper (void *cls, return; } + is->auditor = TALER_AUDITOR_connect (is->ctx, + auditor_base_url, + &auditor_version_cb, + is); GNUNET_free (auditor_base_url); + + if (NULL == is->auditor) + { + GNUNET_break (0); + return; + } + cc = GNUNET_new (struct CleanupContext); cc->is = is; cc->fcb = is->final_cleanup_cb; cc->fcb_cls = is->final_cleanup_cb; - is->final_cleanup_cb = NULL; + is->final_cleanup_cb = cleanup_auditor; is->final_cleanup_cb_cls = cc; mwc->main_cb (mwc->main_cb_cls, is); -- cgit v1.2.3