diff options
author | Florian Dold <florian.dold@gmail.com> | 2020-01-22 13:53:11 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2020-01-22 13:53:11 +0100 |
commit | 0fe82acc1b7a57d53903624a5789ca83dfae2b45 (patch) | |
tree | 331135caa658435c829bb6537211294300150bfc | |
parent | 975d9c9d15e5b6694639e55c7d73d4d86fc48cab (diff) |
better naming, comments and more logging for incoming history
-rw-r--r-- | src/bank-lib/bank_api_credit.c | 22 |
1 files changed, 13 insertions, 9 deletions
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; } |