Adapt serialized reconnect to use public cert_cb.

This commit is contained in:
Marcello Stanisci 2019-01-21 15:48:34 +01:00
parent 544a8edc8c
commit c9eab0f5a5
No known key found for this signature in database
GPG Key ID: 8D526861953F4C0F

View File

@ -98,6 +98,7 @@ serialize_keys_run (void *cls,
(TALER_EXCHANGE_get_base_url (is->exchange)); (TALER_EXCHANGE_get_base_url (is->exchange));
TALER_EXCHANGE_disconnect (is->exchange); TALER_EXCHANGE_disconnect (is->exchange);
is->exchange = NULL; is->exchange = NULL;
is->working = GNUNET_NO;
TALER_TESTING_interpreter_next (is); TALER_TESTING_interpreter_next (is);
} }
@ -155,36 +156,6 @@ serialize_keys_traits (void *cls,
index); 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. * Run the command.
@ -203,6 +174,12 @@ connect_with_state_run (void *cls,
const json_t *serialized_keys; const json_t *serialized_keys;
const char *exchange_url; 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; cwss->is = is;
state_cmd = TALER_TESTING_interpreter_lookup_command state_cmd = TALER_TESTING_interpreter_lookup_command
(is, cwss->state_reference); (is, cwss->state_reference);
@ -234,11 +211,13 @@ connect_with_state_run (void *cls,
is->exchange = TALER_EXCHANGE_connect is->exchange = TALER_EXCHANGE_connect
(is->ctx, (is->ctx,
exchange_url, exchange_url,
cb, TALER_TESTING_cert_cb,
cwss, cwss,
TALER_EXCHANGE_OPTION_DATA, TALER_EXCHANGE_OPTION_DATA,
serialized_keys, serialized_keys,
TALER_EXCHANGE_OPTION_END); TALER_EXCHANGE_OPTION_END);
cwss->consumed = GNUNET_YES;
} }