From 0fe82acc1b7a57d53903624a5789ca83dfae2b45 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 22 Jan 2020 13:53:11 +0100 Subject: better naming, comments and more logging for incoming history --- src/bank-lib/bank_api_credit.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src/bank-lib') diff --git a/src/bank-lib/bank_api_credit.c b/src/bank-lib/bank_api_credit.c index a99b34e26..50725a4ed 100644 --- a/src/bank-lib/bank_api_credit.c +++ b/src/bank-lib/bank_api_credit.c @@ -132,16 +132,16 @@ parse_account_history (struct TALER_BANK_CreditHistoryHandle *hh, /** * Function called when we're done processing the - * HTTP /history request. + * HTTP /history/incoming request. * * @param cls the `struct TALER_BANK_CreditHistoryHandle` * @param response_code HTTP response code, 0 on error * @param response parsed JSON result, NULL on error */ static void -handle_history_finished (void *cls, - long response_code, - const void *response) +handle_credit_history_finished (void *cls, + long response_code, + const void *response) { struct TALER_BANK_CreditHistoryHandle *hh = cls; enum TALER_ErrorCode ec; @@ -167,32 +167,36 @@ handle_history_finished (void *cls, response_code = MHD_HTTP_NO_CONTENT; /* signal end of list */ ec = TALER_EC_NONE; break; - case MHD_HTTP_NO_CONTENT: - ec = TALER_EC_NONE; - break; case MHD_HTTP_BAD_REQUEST: /* This should never happen, either us or the bank is buggy (or API version conflict); just pass JSON reply to the application */ + GNUNET_break_op (0); ec = TALER_JSON_get_error_code (j); break; case MHD_HTTP_FORBIDDEN: /* Access denied */ + GNUNET_break_op (0); ec = TALER_JSON_get_error_code (j); break; case MHD_HTTP_UNAUTHORIZED: + /* FIXME(dold): I don't get this comment below. What signatures would the + bank even verify?! */ /* Nothing really to verify, bank says one of the signatures is invalid; as we checked them, this should never happen, we should pass the JSON reply to the application */ + GNUNET_break_op (0); ec = TALER_JSON_get_error_code (j); break; case MHD_HTTP_NOT_FOUND: /* Nothing really to verify, this should never happen, we should pass the JSON reply to the application */ + GNUNET_break_op (0); ec = TALER_JSON_get_error_code (j); break; case MHD_HTTP_INTERNAL_SERVER_ERROR: /* Server had an internal issue; we should retry, but this API leaves this to the application */ + GNUNET_break_op (0); ec = TALER_JSON_get_error_code (j); break; default: @@ -200,7 +204,7 @@ handle_history_finished (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unexpected response code %u\n", (unsigned int) response_code); - GNUNET_break (0); + GNUNET_break_op (0); ec = TALER_JSON_get_error_code (j); response_code = 0; break; @@ -297,7 +301,7 @@ TALER_BANK_credit_history (struct GNUNET_CURL_Context *ctx, hh->job = GNUNET_CURL_job_add2 (ctx, eh, NULL, - &handle_history_finished, + &handle_credit_history_finished, hh); return hh; } -- cgit v1.2.3