Merge branch 'master' of git+ssh://taler.net/var/git/exchange

This commit is contained in:
Christian Grothoff 2016-06-11 16:17:03 +02:00
commit 06622fbf8e

View File

@ -293,9 +293,10 @@ do_shutdown (void *cls);
static void static void
fail (const char *msg) fail (const char *msg)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, if (NULL != msg)
"%s\n", GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
msg); "%s\n",
msg);
GNUNET_SCHEDULER_shutdown (); GNUNET_SCHEDULER_shutdown ();
return; return;
} }
@ -467,7 +468,7 @@ deposit_cb (void *cls,
} }
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"prepared blob %d\n", "prepared blob %d\n",
blob_size); (unsigned int) blob_size);
refreshed_once = GNUNET_YES; refreshed_once = GNUNET_YES;
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@ -748,8 +749,10 @@ benchmark_run (void *cls)
* since that is the only amount refreshed so far by the benchmark * since that is the only amount refreshed so far by the benchmark
* *
* @param NULL-terminated array of value.fraction pairs * @param NULL-terminated array of value.fraction pairs
* @return GNUNET_OK if the array is correctly built, GNUNET_SYSERR
* otherwise
*/ */
static void static unsigned int
build_refresh (char **list) build_refresh (char **list)
{ {
char *amount_str; char *amount_str;
@ -765,11 +768,16 @@ build_refresh (char **list)
GNUNET_asprintf (&amount_str, "%s:%s", currency, list[i]); GNUNET_asprintf (&amount_str, "%s:%s", currency, list[i]);
TALER_string_to_amount (amount_str, &amount); TALER_string_to_amount (amount_str, &amount);
picked_denom = find_pk (keys, &amount); picked_denom = find_pk (keys, &amount);
if (NULL == picked_denom)
{
return GNUNET_SYSERR;
}
size = i; size = i;
GNUNET_array_append (refresh_pk, size, *picked_denom); GNUNET_array_append (refresh_pk, size, *picked_denom);
GNUNET_free (amount_str); GNUNET_free (amount_str);
} }
refresh_pk_len = i; refresh_pk_len = i;
return GNUNET_OK;
} }
@ -811,7 +819,12 @@ cert_cb (void *cls,
NULL NULL
}; };
build_refresh (refresh_denoms); if (GNUNET_SYSERR == build_refresh (refresh_denoms))
{
fail(NULL);
return;
}
benchmark_task = GNUNET_SCHEDULER_add_now (&benchmark_run, benchmark_task = GNUNET_SCHEDULER_add_now (&benchmark_run,
NULL); NULL);
} }
@ -839,7 +852,9 @@ do_shutdown (void *cls)
{ {
if (NULL != reserves[i].aih) if (NULL != reserves[i].aih)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Cancelling %d-th reserve\n", i); GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Cancelling %d-th reserve\n",
i);
TALER_EXCHANGE_admin_add_incoming_cancel(reserves[i].aih); TALER_EXCHANGE_admin_add_incoming_cancel(reserves[i].aih);
reserves[i].aih = NULL; reserves[i].aih = NULL;
} }
@ -849,21 +864,33 @@ do_shutdown (void *cls)
{ {
if (NULL != coins[i].wsh) if (NULL != coins[i].wsh)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Cancelling %d-th coin withdraw handle\n",
i);
TALER_EXCHANGE_reserve_withdraw_cancel(coins[i].wsh); TALER_EXCHANGE_reserve_withdraw_cancel(coins[i].wsh);
coins[i].wsh = NULL; coins[i].wsh = NULL;
} }
if (NULL != coins[i].dh) if (NULL != coins[i].dh)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Cancelling %d-th coin deposit handle\n",
i);
TALER_EXCHANGE_deposit_cancel(coins[i].dh); TALER_EXCHANGE_deposit_cancel(coins[i].dh);
coins[i].dh = NULL; coins[i].dh = NULL;
} }
if (NULL != coins[i].rmh) if (NULL != coins[i].rmh)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Cancelling %d-th coin melt handle\n",
i);
TALER_EXCHANGE_refresh_melt_cancel(coins[i].rmh); TALER_EXCHANGE_refresh_melt_cancel(coins[i].rmh);
coins[i].rmh = NULL; coins[i].rmh = NULL;
} }
if (NULL != coins[i].rrh) if (NULL != coins[i].rrh)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Cancelling %d-th coin reveal handle\n",
i);
TALER_EXCHANGE_refresh_reveal_cancel(coins[i].rrh); TALER_EXCHANGE_refresh_reveal_cancel(coins[i].rrh);
coins[i].rmh = NULL; coins[i].rmh = NULL;
} }
@ -881,19 +908,27 @@ do_shutdown (void *cls)
if (NULL != exchange) if (NULL != exchange)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Disconnecting from exchange\n");
TALER_EXCHANGE_disconnect (exchange); TALER_EXCHANGE_disconnect (exchange);
exchange = NULL; exchange = NULL;
} }
if (NULL != ctx) if (NULL != ctx)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Invoking GNUNET_CURL_fini()\n");
GNUNET_CURL_fini (ctx); GNUNET_CURL_fini (ctx);
ctx = NULL; ctx = NULL;
} }
if (NULL != rc) if (NULL != rc)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Invoking GNUNET_CURL_gnunet_rc_destroy()\n");
GNUNET_CURL_gnunet_rc_destroy (rc); GNUNET_CURL_gnunet_rc_destroy (rc);
rc = NULL; rc = NULL;
} }
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"All (?) tasks shut down\n");
} }