-minor code cleanup

This commit is contained in:
Christian Grothoff 2022-03-19 15:54:05 +01:00
parent 685837ad28
commit c4690a44bc
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
4 changed files with 45 additions and 36 deletions

View File

@ -131,7 +131,7 @@ struct TEAH_AuditorListEntry
* Flag indicating that the auditor is available and that protocol * Flag indicating that the auditor is available and that protocol
* version compatibility is given. * version compatibility is given.
*/ */
int is_up; bool is_up;
}; };
@ -207,7 +207,7 @@ TEAH_get_auditors_for_dc (struct TALER_EXCHANGE_Handle *h,
{ {
struct TEAH_AuditorInteractionEntry *aie; struct TEAH_AuditorInteractionEntry *aie;
if (GNUNET_NO == ale->is_up) if (! ale->is_up)
continue; continue;
aie = ac (ac_cls, aie = ac (ac_cls,
ale->ah, ale->ah,
@ -344,7 +344,6 @@ parse_json_denomkey (const char *currency,
GNUNET_JSON_spec_end () GNUNET_JSON_spec_end ()
}; };
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_JSON_parse (denom_key_obj, GNUNET_JSON_parse (denom_key_obj,
spec, spec,
@ -353,7 +352,6 @@ parse_json_denomkey (const char *currency,
GNUNET_break_op (0); GNUNET_break_op (0);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
TALER_denom_pub_hash (&denom_key->key, TALER_denom_pub_hash (&denom_key->key,
&denom_key->h_key); &denom_key->h_key);
if (NULL != hash_context) if (NULL != hash_context)
@ -553,7 +551,7 @@ auditor_version_cb (
} }
return; return;
} }
ale->is_up = GNUNET_YES; ale->is_up = true;
} }
@ -591,7 +589,8 @@ update_auditors (struct TALER_EXCHANGE_Handle *exchange)
continue; /* found, no need to add */ continue; /* found, no need to add */
/* new auditor, add */ /* new auditor, add */
TALER_LOG_DEBUG ("Found new auditor!\n"); TALER_LOG_DEBUG ("Found new auditor %s!\n",
auditor->auditor_url);
ale = GNUNET_new (struct TEAH_AuditorListEntry); ale = GNUNET_new (struct TEAH_AuditorListEntry);
ale->auditor_pub = auditor->auditor_pub; ale->auditor_pub = auditor->auditor_pub;
ale->auditor_url = GNUNET_strdup (auditor->auditor_url); ale->auditor_url = GNUNET_strdup (auditor->auditor_url);
@ -836,16 +835,22 @@ decode_keys_json (const json_t *resp_obj,
* "age_restricted_denoms" * "age_restricted_denoms"
*/ */
struct struct
{ char *name; {
char *name;
struct GNUNET_HashContext *hc; struct GNUNET_HashContext *hc;
bool is_optional_age_restriction;} bool is_optional_age_restriction;
}
hive[2] = { hive[2] = {
{ "denoms", {
"denoms",
hash_context, hash_context,
false }, false
{ "age_restricted_denoms", },
{
"age_restricted_denoms",
hash_context_restricted, hash_context_restricted,
true } true
}
}; };
for (size_t s = 0; s < sizeof(hive) / sizeof(hive[0]); s++) for (size_t s = 0; s < sizeof(hive) / sizeof(hive[0]); s++)

View File

@ -241,6 +241,7 @@ deposit_cb (void *cls,
ds->backoff = GNUNET_TIME_randomized_backoff (ds->backoff, ds->backoff = GNUNET_TIME_randomized_backoff (ds->backoff,
MAX_BACKOFF); MAX_BACKOFF);
ds->is->commands[ds->is->ip].num_tries++; ds->is->commands[ds->is->ip].num_tries++;
GNUNET_assert (NULL == ds->retry_task);
ds->retry_task ds->retry_task
= GNUNET_SCHEDULER_add_delayed (ds->backoff, = GNUNET_SCHEDULER_add_delayed (ds->backoff,
&do_retry, &do_retry,
@ -452,6 +453,7 @@ deposit_run (void *cls,
coin_priv, coin_priv,
&coin_sig); &coin_sig);
} }
GNUNET_assert (NULL == ds->dh);
ds->dh = TALER_EXCHANGE_deposit (is->exchange, ds->dh = TALER_EXCHANGE_deposit (is->exchange,
&ds->amount, &ds->amount,
ds->wire_deadline, ds->wire_deadline,
@ -552,14 +554,14 @@ deposit_traits (void *cls,
TALER_TESTING_interpreter_fail (ds->is); TALER_TESTING_interpreter_fail (ds->is);
return GNUNET_NO; return GNUNET_NO;
} }
if (GNUNET_OK != if ( (GNUNET_OK !=
TALER_TESTING_get_trait_coin_priv (coin_cmd, TALER_TESTING_get_trait_coin_priv (coin_cmd,
ds->coin_index, ds->coin_index,
&coin_spent_priv) || &coin_spent_priv)) ||
(GNUNET_OK != (GNUNET_OK !=
TALER_TESTING_get_trait_age_commitment_proof (coin_cmd, TALER_TESTING_get_trait_age_commitment_proof (coin_cmd,
ds->coin_index, ds->coin_index,
&age_commitment_proof))) &age_commitment_proof)) )
{ {
GNUNET_break (0); GNUNET_break (0);
TALER_TESTING_interpreter_fail (ds->is); TALER_TESTING_interpreter_fail (ds->is);

View File

@ -720,7 +720,8 @@ TALER_TESTING_setup_with_exchange_cfg (
return GNUNET_NO; return GNUNET_NO;
} }
if (0 == strcmp ("tcp", serve)) if (0 == strcmp ("tcp",
serve))
{ {
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_number (cfg, GNUNET_CONFIGURATION_get_value_number (cfg,

View File

@ -270,17 +270,14 @@ do_shutdown (void *cls)
label = is->commands[is->ip].label; label = is->commands[is->ip].label;
if (NULL == label) if (NULL == label)
label = "END"; label = "END";
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Executing shutdown at `%s'\n", "Executing shutdown at `%s'\n",
label); label);
for (unsigned int j = 0; for (unsigned int j = 0;
NULL != (cmd = &is->commands[j])->label; NULL != (cmd = &is->commands[j])->label;
j++) j++)
cmd->cleanup (cmd->cls, cmd->cleanup (cmd->cls,
cmd); cmd);
if (NULL != is->exchange) if (NULL != is->exchange)
{ {
TALER_LOG_DEBUG ("Disconnecting the exchange\n"); TALER_LOG_DEBUG ("Disconnecting the exchange\n");
@ -292,6 +289,11 @@ do_shutdown (void *cls)
GNUNET_SCHEDULER_cancel (is->task); GNUNET_SCHEDULER_cancel (is->task);
is->task = NULL; is->task = NULL;
} }
if (NULL != is->fakebank)
{
TALER_FAKEBANK_stop (is->fakebank);
is->fakebank = NULL;
}
if (NULL != is->ctx) if (NULL != is->ctx)
{ {
GNUNET_CURL_fini (is->ctx); GNUNET_CURL_fini (is->ctx);
@ -312,11 +314,6 @@ do_shutdown (void *cls)
GNUNET_SCHEDULER_cancel (is->child_death_task); GNUNET_SCHEDULER_cancel (is->child_death_task);
is->child_death_task = NULL; is->child_death_task = NULL;
} }
if (NULL != is->fakebank)
{
TALER_FAKEBANK_stop (is->fakebank);
is->fakebank = NULL;
}
GNUNET_free (is->commands); GNUNET_free (is->commands);
} }
@ -620,6 +617,11 @@ do_abort (void *cls)
TALER_EXCHANGE_disconnect (is->exchange); TALER_EXCHANGE_disconnect (is->exchange);
is->exchange = NULL; is->exchange = NULL;
} }
if (NULL != is->fakebank)
{
TALER_FAKEBANK_stop (is->fakebank);
is->fakebank = NULL;
}
if (NULL != is->ctx) if (NULL != is->ctx)
{ {
GNUNET_CURL_fini (is->ctx); GNUNET_CURL_fini (is->ctx);
@ -822,18 +824,17 @@ TALER_TESTING_setup (TALER_TESTING_Main main_cb,
return GNUNET_SYSERR; return GNUNET_SYSERR;
sigpipe = GNUNET_DISK_pipe (GNUNET_DISK_PF_NONE); sigpipe = GNUNET_DISK_pipe (GNUNET_DISK_PF_NONE);
GNUNET_assert (NULL != sigpipe); GNUNET_assert (NULL != sigpipe);
shc_chld = GNUNET_SIGNAL_handler_install shc_chld = GNUNET_SIGNAL_handler_install (
(GNUNET_SIGCHLD, GNUNET_SIGCHLD,
&sighandler_child_death); &sighandler_child_death);
is.ctx = GNUNET_CURL_init is.ctx = GNUNET_CURL_init (
(&GNUNET_CURL_gnunet_scheduler_reschedule, &GNUNET_CURL_gnunet_scheduler_reschedule,
&is.rc); &is.rc);
GNUNET_CURL_enable_async_scope_header (is.ctx, GNUNET_CURL_enable_async_scope_header (is.ctx,
"Taler-Correlation-Id"); "Taler-Correlation-Id");
GNUNET_assert (NULL != is.ctx); GNUNET_assert (NULL != is.ctx);
is.rc = GNUNET_CURL_gnunet_rc_create (is.ctx); is.rc = GNUNET_CURL_gnunet_rc_create (is.ctx);
/* Blocking */ /* Blocking */
if (GNUNET_YES == exchange_connect) if (GNUNET_YES == exchange_connect)
GNUNET_SCHEDULER_run (&main_wrapper_exchange_connect, GNUNET_SCHEDULER_run (&main_wrapper_exchange_connect,