more libtalermhd migration

This commit is contained in:
Christian Grothoff 2019-11-23 22:26:11 +01:00
parent 7aae6c9045
commit 7510b6310b
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
5 changed files with 27 additions and 23 deletions

View File

@ -31,7 +31,6 @@
#include "taler_auditordb_lib.h" #include "taler_auditordb_lib.h"
#include "taler-auditor-httpd_deposit-confirmation.h" #include "taler-auditor-httpd_deposit-confirmation.h"
#include "taler-auditor-httpd_exchanges.h" #include "taler-auditor-httpd_exchanges.h"
#include "taler-auditor-httpd_responses.h"
#include "taler-auditor-httpd_mhd.h" #include "taler-auditor-httpd_mhd.h"
#include "taler-auditor-httpd.h" #include "taler-auditor-httpd.h"
@ -332,7 +331,7 @@ handle_version (struct TAH_RequestHandler *rh,
GNUNET_break (0); GNUNET_break (0);
return MHD_NO; return MHD_NO;
} }
return TAH_RESPONSE_reply_json (connection, return TALER_MHD_reply_json (connection,
ver, ver,
MHD_HTTP_OK); MHD_HTTP_OK);
} }

View File

@ -23,8 +23,9 @@
#include <jansson.h> #include <jansson.h>
#include <gnunet/gnunet_json_lib.h> #include <gnunet/gnunet_json_lib.h>
#include "taler_json_lib.h" #include "taler_json_lib.h"
#include "taler_mhd_lib.h"
#include "taler-auditor-httpd_db.h" #include "taler-auditor-httpd_db.h"
#include "taler-auditor-httpd_responses.h" #include "taler-auditor-httpd.h"
/** /**
@ -63,8 +64,10 @@ TAH_DB_run_transaction (struct MHD_Connection *connection,
{ {
GNUNET_break (0); GNUNET_break (0);
if (NULL != mhd_ret) if (NULL != mhd_ret)
*mhd_ret = TAH_RESPONSE_reply_internal_db_error (connection, *mhd_ret = TALER_MHD_reply_with_error (connection,
TALER_EC_DB_SETUP_FAILED); MHD_HTTP_INTERNAL_SERVER_ERROR,
TALER_EC_DB_SETUP_FAILED,
"failed to establish session with database");
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
// TAH_plugin->preflight (TAH_plugin->cls, session); // FIXME: needed? // TAH_plugin->preflight (TAH_plugin->cls, session); // FIXME: needed?
@ -79,8 +82,10 @@ TAH_DB_run_transaction (struct MHD_Connection *connection,
{ {
GNUNET_break (0); GNUNET_break (0);
if (NULL != mhd_ret) if (NULL != mhd_ret)
*mhd_ret = TAH_RESPONSE_reply_internal_db_error (connection, *mhd_ret = TALER_MHD_reply_with_error (connection,
TALER_EC_DB_START_FAILED); MHD_HTTP_INTERNAL_SERVER_ERROR,
TALER_EC_DB_START_FAILED,
"failed to begin transaction");
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
qs = cb (cb_cls, qs = cb (cb_cls,
@ -98,8 +103,10 @@ TAH_DB_run_transaction (struct MHD_Connection *connection,
if (GNUNET_DB_STATUS_HARD_ERROR == qs) if (GNUNET_DB_STATUS_HARD_ERROR == qs)
{ {
if (NULL != mhd_ret) if (NULL != mhd_ret)
*mhd_ret = TAH_RESPONSE_reply_commit_error (connection, *mhd_ret = TALER_MHD_reply_with_error (connection,
TALER_EC_DB_COMMIT_FAILED_HARD); MHD_HTTP_INTERNAL_SERVER_ERROR,
TALER_EC_DB_COMMIT_FAILED_HARD,
"failed to commit transaction");
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
/* make sure callback did not violate invariants! */ /* make sure callback did not violate invariants! */
@ -112,8 +119,10 @@ TAH_DB_run_transaction (struct MHD_Connection *connection,
name, name,
MAX_TRANSACTION_COMMIT_RETRIES); MAX_TRANSACTION_COMMIT_RETRIES);
if (NULL != mhd_ret) if (NULL != mhd_ret)
*mhd_ret = TAH_RESPONSE_reply_commit_error (connection, *mhd_ret = TALER_MHD_reply_with_error (connection,
TALER_EC_DB_COMMIT_FAILED_ON_RETRY); MHD_HTTP_INTERNAL_SERVER_ERROR,
TALER_EC_DB_COMMIT_FAILED_ON_RETRY,
"transaction repeatedly failed to serialize");
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }

View File

@ -31,7 +31,6 @@
#include "taler-auditor-httpd.h" #include "taler-auditor-httpd.h"
#include "taler-auditor-httpd_db.h" #include "taler-auditor-httpd_db.h"
#include "taler-auditor-httpd_deposit-confirmation.h" #include "taler-auditor-httpd_deposit-confirmation.h"
#include "taler-auditor-httpd_responses.h"
/** /**

View File

@ -29,7 +29,6 @@
#include "taler-auditor-httpd.h" #include "taler-auditor-httpd.h"
#include "taler-auditor-httpd_db.h" #include "taler-auditor-httpd_db.h"
#include "taler-auditor-httpd_exchanges.h" #include "taler-auditor-httpd_exchanges.h"
#include "taler-auditor-httpd_responses.h"
/** /**

View File

@ -29,8 +29,6 @@
#include <microhttpd.h> #include <microhttpd.h>
#include <pthread.h> #include <pthread.h>
#include "taler_mhd_lib.h" #include "taler_mhd_lib.h"
#include "taler-auditor-httpd_responses.h"
#include "taler-auditor-httpd_responses.h"
#include "taler-auditor-httpd.h" #include "taler-auditor-httpd.h"
#include "taler-auditor-httpd_mhd.h" #include "taler-auditor-httpd_mhd.h"
@ -65,7 +63,7 @@ TAH_MHD_handler_static_response (struct TAH_RequestHandler *rh,
GNUNET_break (0); GNUNET_break (0);
return MHD_NO; return MHD_NO;
} }
TAH_RESPONSE_add_global_headers (response); TALER_MHD_add_global_headers (response);
if (NULL != rh->mime_type) if (NULL != rh->mime_type)
(void) MHD_add_response_header (response, (void) MHD_add_response_header (response,
MHD_HTTP_HEADER_CONTENT_TYPE, MHD_HTTP_HEADER_CONTENT_TYPE,
@ -123,7 +121,7 @@ TAH_MHD_handler_send_json_pack_error (struct TAH_RequestHandler *rh,
const char *upload_data, const char *upload_data,
size_t *upload_data_size) size_t *upload_data_size)
{ {
return TAH_RESPONSE_reply_json_pack (connection, return TALER_MHD_reply_json_pack (connection,
rh->response_code, rh->response_code,
"{s:s}", "{s:s}",
"error", "error",