This commit is contained in:
Christian Grothoff 2021-07-30 14:20:39 +02:00
parent d821db366a
commit c0d4a35a51
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
2 changed files with 41 additions and 23 deletions

View File

@ -139,6 +139,12 @@ static json_t *out;
*/
static char *currency;
/**
* URL of the exchange we are interacting with
* as per our configuration.
*/
static char *CFG_exchange_url;
/**
* A subcommand supported by this program.
@ -1789,11 +1795,12 @@ do_upload (char *const *args)
global_ret = EXIT_FAILURE;
return;
}
if (GNUNET_OK !=
if ( (NULL == CFG_exchange_url) &&
(GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string (kcfg,
"exchange",
"BASE_URL",
&exchange_url))
&CFG_exchange_url)) )
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"exchange",
@ -1802,10 +1809,9 @@ do_upload (char *const *args)
test_shutdown ();
return;
}
trigger_upload (exchange_url);
trigger_upload (CFG_exchange_url);
json_decref (out);
out = NULL;
GNUNET_free (exchange_url);
}
@ -2264,11 +2270,17 @@ download_cb (void *cls,
case MHD_HTTP_OK:
break;
default:
if (0 != hr->http_status)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to download keys: %s (HTTP status: %u/%u)\n",
"Failed to download keys from `%s': %s (HTTP status: %u/%u)\n",
CFG_exchange_url,
hr->hint,
hr->http_status,
(unsigned int) hr->ec);
else
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to download keys from `%s' (no HTTP response)\n",
CFG_exchange_url);
test_shutdown ();
global_ret = EXIT_FAILURE;
return;
@ -2298,13 +2310,12 @@ download_cb (void *cls,
static void
do_download (char *const *args)
{
char *exchange_url;
if (GNUNET_OK !=
if ( (NULL == CFG_exchange_url) &&
(GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string (kcfg,
"exchange",
"BASE_URL",
&exchange_url))
&CFG_exchange_url)) )
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"exchange",
@ -2314,10 +2325,9 @@ do_download (char *const *args)
return;
}
mgkh = TALER_EXCHANGE_get_management_keys (ctx,
exchange_url,
CFG_exchange_url,
&download_cb,
(void *) args);
GNUNET_free (exchange_url);
}

View File

@ -298,8 +298,16 @@ handle_get_keys_finished (void *cls,
break;
default:
/* unexpected response code */
if (NULL != json)
{
hr.ec = TALER_JSON_get_error_code (json);
hr.hint = TALER_JSON_get_error_hint (json);
}
else
{
hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
hr.hint = TALER_ErrorCode_get_hint (hr.ec);
}
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected response code %u/%d for exchange management get keys\n",
(unsigned int) response_code,