From c9eab0f5a5ceca381a330f38bc153b89c3892003 Mon Sep 17 00:00:00 2001 From: Marcello Stanisci Date: Mon, 21 Jan 2019 15:48:34 +0100 Subject: [PATCH] Adapt serialized reconnect to use public cert_cb. --- src/lib/testing_api_cmd_serialize_keys.c | 41 ++++++------------------ 1 file changed, 10 insertions(+), 31 deletions(-) diff --git a/src/lib/testing_api_cmd_serialize_keys.c b/src/lib/testing_api_cmd_serialize_keys.c index 38d32eadd..585c5cad8 100644 --- a/src/lib/testing_api_cmd_serialize_keys.c +++ b/src/lib/testing_api_cmd_serialize_keys.c @@ -98,6 +98,7 @@ serialize_keys_run (void *cls, (TALER_EXCHANGE_get_base_url (is->exchange)); TALER_EXCHANGE_disconnect (is->exchange); is->exchange = NULL; + is->working = GNUNET_NO; TALER_TESTING_interpreter_next (is); } @@ -155,36 +156,6 @@ serialize_keys_traits (void *cls, index); } -/** - * /keys callback. Just checks HTTP status is OK, - * and step forward to next command. - * - * @param cls closure - * @param keys information about the various keys used - * by the exchange, NULL if /keys failed - * @param compat protocol compatibility information* - */ -static void -cb (void *cls, - const struct TALER_EXCHANGE_Keys *keys, - enum TALER_EXCHANGE_VersionCompatibility compat) -{ - struct ConnectWithStateState *cwss = cls; - - if (GNUNET_YES == cwss->consumed) - { - TALER_LOG_DEBUG ("Reconnection /keys 'cb' invoked already," - " nothing to do\n"); - return; - } - - cwss->consumed = GNUNET_YES; - if (NULL == keys) - TALER_TESTING_interpreter_fail (cwss->is); - - TALER_LOG_DEBUG ("reconnect next CMD\n"); - TALER_TESTING_interpreter_next (cwss->is); -} /** * Run the command. @@ -203,6 +174,12 @@ connect_with_state_run (void *cls, const json_t *serialized_keys; const char *exchange_url; + + /* This command usually gets rescheduled after serialized + * reconnection. */ + if (GNUNET_YES == cwss->consumed) + TALER_TESTING_interpreter_next (is); + cwss->is = is; state_cmd = TALER_TESTING_interpreter_lookup_command (is, cwss->state_reference); @@ -234,11 +211,13 @@ connect_with_state_run (void *cls, is->exchange = TALER_EXCHANGE_connect (is->ctx, exchange_url, - cb, + TALER_TESTING_cert_cb, cwss, TALER_EXCHANGE_OPTION_DATA, serialized_keys, TALER_EXCHANGE_OPTION_END); + + cwss->consumed = GNUNET_YES; }