summaryrefslogtreecommitdiff
path: root/src/exchange
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-05-02 06:36:58 +0200
committerChristian Grothoff <christian@grothoff.org>2016-05-02 06:36:58 +0200
commit1cbba4bec1551a4662029e2899e5120cc4793c4b (patch)
treea08bbdd6a87e4017cb598cf5028be188cc67cee0 /src/exchange
parent53e7547aaf74a0d34584e221ea92bea85c452d66 (diff)
downloadexchange-1cbba4bec1551a4662029e2899e5120cc4793c4b.tar.gz
exchange-1cbba4bec1551a4662029e2899e5120cc4793c4b.tar.bz2
exchange-1cbba4bec1551a4662029e2899e5120cc4793c4b.zip
fixing #4462: avoid temporary schemata altogether
Diffstat (limited to 'src/exchange')
-rw-r--r--src/exchange/taler-exchange-aggregator.c10
-rw-r--r--src/exchange/taler-exchange-httpd.c22
-rw-r--r--src/exchange/taler-exchange-httpd.h5
-rw-r--r--src/exchange/taler-exchange-httpd_db.c27
-rw-r--r--src/exchange/taler-exchange-httpd_keystate.c3
-rw-r--r--src/exchange/test_taler_exchange_aggregator.c10
6 files changed, 19 insertions, 58 deletions
diff --git a/src/exchange/taler-exchange-aggregator.c b/src/exchange/taler-exchange-aggregator.c
index 57eab8138..4732e4e18 100644
--- a/src/exchange/taler-exchange-aggregator.c
+++ b/src/exchange/taler-exchange-aggregator.c
@@ -173,7 +173,7 @@ static struct AggregationUnit *au;
static int global_ret;
/**
- * #GNUNET_YES if we are in test mode and are using temporary tables.
+ * #GNUNET_YES if we are in test mode and should exit when idle.
*/
static int test_mode;
@@ -518,8 +518,7 @@ run_aggregation (void *cls)
return;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Checking for ready deposits to aggregate\n");
- if (NULL == (session = db_plugin->get_session (db_plugin->cls,
- test_mode)))
+ if (NULL == (session = db_plugin->get_session (db_plugin->cls)))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to obtain database session!\n");
@@ -891,8 +890,7 @@ run_transfers (void *cls)
tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
- if (NULL == (session = db_plugin->get_session (db_plugin->cls,
- test_mode)))
+ if (NULL == (session = db_plugin->get_session (db_plugin->cls)))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to obtain database session!\n");
@@ -987,7 +985,7 @@ main (int argc,
"wireformat to use, overrides WIREFORMAT option in [exchange] section", 1,
&GNUNET_GETOPT_set_filename, &exchange_wireformat},
{'t', "test", NULL,
- "run in test mode with temporary tables", 0,
+ "run in test mode and exit when idle", 0,
&GNUNET_GETOPT_set_one, &test_mode},
GNUNET_GETOPT_OPTION_VERSION (VERSION "-" VCS_VERSION),
GNUNET_GETOPT_OPTION_END
diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c
index 11f2e1c9d..5f9f51422 100644
--- a/src/exchange/taler-exchange-httpd.c
+++ b/src/exchange/taler-exchange-httpd.c
@@ -81,11 +81,6 @@ struct TALER_MasterPublicKeyP TMH_master_public_key;
struct TALER_EXCHANGEDB_Plugin *TMH_plugin;
/**
- * Are we running in test mode?
- */
-int TMH_test_mode;
-
-/**
* Default timeout in seconds for HTTP requests.
*/
static unsigned int connection_timeout = 30;
@@ -466,9 +461,7 @@ exchange_serve_process_config ()
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Running in TEST mode! Database contents will not persist!\n");
- TMH_test_mode = GNUNET_YES;
- TMH_plugin->create_tables (TMH_plugin->cls,
- GNUNET_YES);
+ TMH_plugin->create_tables (TMH_plugin->cls);
}
{
@@ -906,19 +899,6 @@ main (int argc,
MHD_stop_daemon (mydaemon);
break;
}
-
- if (GNUNET_YES == TMH_test_mode)
- {
- struct TALER_EXCHANGEDB_Session *session;
-
- session = TMH_plugin->get_session (TMH_plugin->cls,
- GNUNET_YES);
- if (NULL == session)
- GNUNET_break (0);
- else
- TMH_plugin->drop_temporary (TMH_plugin->cls,
- session);
- }
TALER_EXCHANGEDB_plugin_unload (TMH_plugin);
TMH_VALIDATION_done ();
return (GNUNET_SYSERR == ret) ? 1 : 0;
diff --git a/src/exchange/taler-exchange-httpd.h b/src/exchange/taler-exchange-httpd.h
index 236df9e19..54e382f52 100644
--- a/src/exchange/taler-exchange-httpd.h
+++ b/src/exchange/taler-exchange-httpd.h
@@ -44,11 +44,6 @@ extern int TMH_exchange_connection_close;
extern struct GNUNET_CONFIGURATION_Handle *cfg;
/**
- * Are we running in test mode?
- */
-extern int TMH_test_mode;
-
-/**
* Main directory with exchange data.
*/
extern char *TMH_exchange_directory;
diff --git a/src/exchange/taler-exchange-httpd_db.c b/src/exchange/taler-exchange-httpd_db.c
index 4b6b458ce..237a1aa7c 100644
--- a/src/exchange/taler-exchange-httpd_db.c
+++ b/src/exchange/taler-exchange-httpd_db.c
@@ -160,8 +160,7 @@ TMH_DB_execute_deposit (struct MHD_Connection *connection,
struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki;
int ret;
- if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls,
- TMH_test_mode)))
+ if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls)))
{
GNUNET_break (0);
return TMH_RESPONSE_reply_internal_db_error (connection);
@@ -278,8 +277,7 @@ TMH_DB_execute_reserve_status (struct MHD_Connection *connection,
struct TALER_EXCHANGEDB_ReserveHistory *rh;
int res;
- if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls,
- TMH_test_mode)))
+ if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls)))
{
GNUNET_break (0);
return TMH_RESPONSE_reply_internal_db_error (connection);
@@ -524,8 +522,7 @@ TMH_DB_execute_reserve_withdraw (struct MHD_Connection *connection,
GNUNET_CRYPTO_hash (blinded_msg,
blinded_msg_len,
&h_blind);
- if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls,
- TMH_test_mode)))
+ if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls)))
{
GNUNET_break (0);
return TMH_RESPONSE_reply_internal_db_error (connection);
@@ -725,8 +722,7 @@ TMH_DB_execute_refresh_melt (struct MHD_Connection *connection,
int res;
unsigned int i;
- if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls,
- TMH_test_mode)))
+ if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls)))
{
GNUNET_break (0);
return TMH_RESPONSE_reply_internal_db_error (connection);
@@ -1237,8 +1233,7 @@ TMH_DB_execute_refresh_reveal (struct MHD_Connection *connection,
unsigned int j;
unsigned int off;
- if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls,
- TMH_test_mode)))
+ if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls)))
{
GNUNET_break (0);
return TMH_RESPONSE_reply_internal_db_error (connection);
@@ -1465,8 +1460,7 @@ TMH_DB_execute_refresh_link (struct MHD_Connection *connection,
int res;
unsigned int i;
- if (NULL == (ctx.session = TMH_plugin->get_session (TMH_plugin->cls,
- TMH_test_mode)))
+ if (NULL == (ctx.session = TMH_plugin->get_session (TMH_plugin->cls)))
{
GNUNET_break (0);
return TMH_RESPONSE_reply_internal_db_error (connection);
@@ -1528,8 +1522,7 @@ TMH_DB_execute_admin_add_incoming (struct MHD_Connection *connection,
struct TALER_EXCHANGEDB_Session *session;
int ret;
- if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls,
- TMH_test_mode)))
+ if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls)))
{
GNUNET_break (0);
return TMH_RESPONSE_reply_internal_db_error (connection);
@@ -1713,8 +1706,7 @@ TMH_DB_execute_wire_deposits (struct MHD_Connection *connection,
struct TALER_EXCHANGEDB_Session *session;
struct TMH_WireDepositDetail *wdd;
- if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls,
- TMH_test_mode)))
+ if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls)))
{
GNUNET_break (0);
return TMH_RESPONSE_reply_internal_db_error (connection);
@@ -1879,8 +1871,7 @@ TMH_DB_execute_deposit_wtid (struct MHD_Connection *connection,
struct DepositWtidContext ctx;
struct TALER_EXCHANGEDB_Session *session;
- if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls,
- TMH_test_mode)))
+ if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls)))
{
GNUNET_break (0);
return TMH_RESPONSE_reply_internal_db_error (connection);
diff --git a/src/exchange/taler-exchange-httpd_keystate.c b/src/exchange/taler-exchange-httpd_keystate.c
index 5d564d864..2f5069d4a 100644
--- a/src/exchange/taler-exchange-httpd_keystate.c
+++ b/src/exchange/taler-exchange-httpd_keystate.c
@@ -250,8 +250,7 @@ reload_keys_denom_iter (void *cls,
GNUNET_CRYPTO_hash_context_read (ctx->hash_context,
&denom_key_hash,
sizeof (struct GNUNET_HashCode));
- session = TMH_plugin->get_session (TMH_plugin->cls,
- TMH_test_mode);
+ session = TMH_plugin->get_session (TMH_plugin->cls);
if (NULL == session)
return GNUNET_SYSERR;
/* Try to insert DKI into DB until we succeed; note that if the DB
diff --git a/src/exchange/test_taler_exchange_aggregator.c b/src/exchange/test_taler_exchange_aggregator.c
index d9052ec7d..d38d07906 100644
--- a/src/exchange/test_taler_exchange_aggregator.c
+++ b/src/exchange/test_taler_exchange_aggregator.c
@@ -285,8 +285,8 @@ shutdown_action (void *cls)
GNUNET_OS_process_destroy (aggregator_proc);
aggregator_proc = NULL;
}
- plugin->drop_temporary (plugin->cls,
- session);
+ plugin->drop_tables (plugin->cls,
+ session);
TALER_EXCHANGEDB_plugin_unload (plugin);
plugin = NULL;
}
@@ -1106,8 +1106,7 @@ run (void *cls)
plugin = TALER_EXCHANGEDB_plugin_load (cfg);
if (GNUNET_OK !=
- plugin->create_tables (plugin->cls,
- GNUNET_YES))
+ plugin->create_tables (plugin->cls))
{
GNUNET_break (0);
TALER_EXCHANGEDB_plugin_unload (plugin);
@@ -1115,8 +1114,7 @@ run (void *cls)
result = 77;
return;
}
- session = plugin->get_session (plugin->cls,
- GNUNET_YES);
+ session = plugin->get_session (plugin->cls);
GNUNET_assert (NULL != session);
fake_issue (&issue);
dpk.rsa_public_key = coin_pub;