diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-04-05 22:05:38 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-04-05 22:05:38 +0200 |
commit | bf8c5982a2e79f0b5198a0033dd41e9702d093f9 (patch) | |
tree | 93b62feb9b7e24ae3d4f73b1a5f883a8fc368bfe /src/testing/testing_api_cmd_deposit.c | |
parent | 5059da7108fb2d65fc3844ffe695574c532f8dff (diff) | |
download | exchange-bf8c5982a2e79f0b5198a0033dd41e9702d093f9.tar.xz |
make exchange API more uniform in how information is returned
Diffstat (limited to 'src/testing/testing_api_cmd_deposit.c')
-rw-r--r-- | src/testing/testing_api_cmd_deposit.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/src/testing/testing_api_cmd_deposit.c b/src/testing/testing_api_cmd_deposit.c index fcba7f270..c11c49ac6 100644 --- a/src/testing/testing_api_cmd_deposit.c +++ b/src/testing/testing_api_cmd_deposit.c @@ -197,40 +197,36 @@ do_retry (void *cls) * check if the response code is acceptable. * * @param cls closure. - * @param http_status HTTP response code. - * @param ec taler-specific error code. + * @param hr HTTP response details * @param exchange_sig signature provided by the exchange * (NULL on errors) * @param exchange_pub public key of the exchange, * used for signing the response. - * @param obj raw response from the exchange. */ static void deposit_cb (void *cls, - unsigned int http_status, - enum TALER_ErrorCode ec, + const struct TALER_EXCHANGE_HttpResponse *hr, const struct TALER_ExchangeSignatureP *exchange_sig, - const struct TALER_ExchangePublicKeyP *exchange_pub, - const json_t *obj) + const struct TALER_ExchangePublicKeyP *exchange_pub) { struct DepositState *ds = cls; ds->dh = NULL; - if (ds->expected_response_code != http_status) + if (ds->expected_response_code != hr->http_status) { if (0 != ds->do_retry) { ds->do_retry--; - if ( (0 == http_status) || - (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec) || - (MHD_HTTP_INTERNAL_SERVER_ERROR == http_status) ) + if ( (0 == hr->http_status) || + (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == hr->ec) || + (MHD_HTTP_INTERNAL_SERVER_ERROR == hr->http_status) ) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Retrying deposit failed with %u/%d\n", - http_status, - (int) ec); + hr->http_status, + (int) hr->ec); /* on DB conflicts, do not use backoff */ - if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec) + if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == hr->ec) ds->backoff = GNUNET_TIME_UNIT_ZERO; else ds->backoff = GNUNET_TIME_randomized_backoff (ds->backoff, @@ -245,15 +241,17 @@ deposit_cb (void *cls, } GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unexpected response code %u to command %s in %s:%u\n", - http_status, + hr->http_status, ds->is->commands[ds->is->ip].label, __FILE__, __LINE__); - json_dumpf (obj, stderr, 0); + json_dumpf (hr->reply, + stderr, + 0); TALER_TESTING_interpreter_fail (ds->is); return; } - if (MHD_HTTP_OK == http_status) + if (MHD_HTTP_OK == hr->http_status) { ds->deposit_succeeded = GNUNET_YES; ds->exchange_pub = *exchange_pub; |