better naming, comments and more logging for incoming history
This commit is contained in:
parent
975d9c9d15
commit
0fe82acc1b
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user