-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
* 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;
if (GNUNET_NO == ale->is_up)
if (! ale->is_up)
continue;
aie = ac (ac_cls,
ale->ah,
@ -344,7 +344,6 @@ parse_json_denomkey (const char *currency,
GNUNET_JSON_spec_end ()
};
if (GNUNET_OK !=
GNUNET_JSON_parse (denom_key_obj,
spec,
@ -353,7 +352,6 @@ parse_json_denomkey (const char *currency,
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
TALER_denom_pub_hash (&denom_key->key,
&denom_key->h_key);
if (NULL != hash_context)
@ -553,7 +551,7 @@ auditor_version_cb (
}
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 */
/* 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->auditor_pub = auditor->auditor_pub;
ale->auditor_url = GNUNET_strdup (auditor->auditor_url);
@ -836,16 +835,22 @@ decode_keys_json (const json_t *resp_obj,
* "age_restricted_denoms"
*/
struct
{ char *name;
{
char *name;
struct GNUNET_HashContext *hc;
bool is_optional_age_restriction;}
bool is_optional_age_restriction;
}
hive[2] = {
{ "denoms",
{
"denoms",
hash_context,
false },
{ "age_restricted_denoms",
false
},
{
"age_restricted_denoms",
hash_context_restricted,
true }
true
}
};
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,
MAX_BACKOFF);
ds->is->commands[ds->is->ip].num_tries++;
GNUNET_assert (NULL == ds->retry_task);
ds->retry_task
= GNUNET_SCHEDULER_add_delayed (ds->backoff,
&do_retry,
@ -452,6 +453,7 @@ deposit_run (void *cls,
coin_priv,
&coin_sig);
}
GNUNET_assert (NULL == ds->dh);
ds->dh = TALER_EXCHANGE_deposit (is->exchange,
&ds->amount,
ds->wire_deadline,
@ -552,14 +554,14 @@ deposit_traits (void *cls,
TALER_TESTING_interpreter_fail (ds->is);
return GNUNET_NO;
}
if (GNUNET_OK !=
TALER_TESTING_get_trait_coin_priv (coin_cmd,
ds->coin_index,
&coin_spent_priv) ||
(GNUNET_OK !=
TALER_TESTING_get_trait_age_commitment_proof (coin_cmd,
ds->coin_index,
&age_commitment_proof)))
if ( (GNUNET_OK !=
TALER_TESTING_get_trait_coin_priv (coin_cmd,
ds->coin_index,
&coin_spent_priv)) ||
(GNUNET_OK !=
TALER_TESTING_get_trait_age_commitment_proof (coin_cmd,
ds->coin_index,
&age_commitment_proof)) )
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (ds->is);

View File

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

View File

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