aboutsummaryrefslogtreecommitdiff
path: root/src/benchmark/taler-exchange-benchmark.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-02-04 21:59:43 +0100
committerChristian Grothoff <christian@grothoff.org>2020-02-04 21:59:43 +0100
commit42bc31744b9810509aef344c54bfee2f4e2a7ccb (patch)
tree92ece6674b23f5e985755992a2ddb840cdd2de7f /src/benchmark/taler-exchange-benchmark.c
parente6d6987e5685b35f6c3137f59894a02a63d09766 (diff)
implement /config in fakebank and taler_bank_lib.h (#6066)
Diffstat (limited to 'src/benchmark/taler-exchange-benchmark.c')
-rw-r--r--src/benchmark/taler-exchange-benchmark.c36
1 files changed, 25 insertions, 11 deletions
diff --git a/src/benchmark/taler-exchange-benchmark.c b/src/benchmark/taler-exchange-benchmark.c
index bd4d3eafe..91ed5b047 100644
--- a/src/benchmark/taler-exchange-benchmark.c
+++ b/src/benchmark/taler-exchange-benchmark.c
@@ -156,9 +156,9 @@ static char *mode_str;
static enum BenchmarkMode mode;
/**
- * Config filename.
+ * Configuration.
*/
-static char *cfg_filename;
+static struct GNUNET_CONFIGURATION_Handle *cfg;
/**
* Currency used.
@@ -445,7 +445,8 @@ launch_fakebank (void *cls)
(void) cls;
fakebank
- = TALER_TESTING_run_fakebank (exchange_bank_account.wire_gateway_url);
+ = TALER_TESTING_run_fakebank (exchange_bank_account.wire_gateway_url,
+ currency);
if (NULL == fakebank)
{
GNUNET_break (0);
@@ -624,12 +625,11 @@ parallel_benchmark (TALER_TESTING_Main main_cb,
NULL == loglev ? "INFO" : loglev,
logfile);
- result = TALER_TESTING_setup
- (main_cb,
- main_cb_cls,
- cfg_filename,
- exchanged,
- GNUNET_YES);
+ result = TALER_TESTING_setup (main_cb,
+ main_cb_cls,
+ cfg,
+ exchanged,
+ GNUNET_YES);
if (GNUNET_OK != result)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failure in child process test suite!\n");
@@ -746,7 +746,7 @@ int
main (int argc,
char *const *argv)
{
- struct GNUNET_CONFIGURATION_Handle *cfg;
+ char *cfg_filename = NULL;
struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_option_mandatory
(GNUNET_GETOPT_option_cfgfile (&cfg_filename)),
@@ -798,6 +798,7 @@ main (int argc,
argc,
argv)))
{
+ GNUNET_free_non_null (cfg_filename);
return BAD_CLI_ARG;
}
GNUNET_log_setup ("taler-exchange-benchmark",
@@ -814,6 +815,7 @@ main (int argc,
else
{
TALER_LOG_ERROR ("Unknown mode given: '%s'\n", mode_str);
+ GNUNET_free_non_null (cfg_filename);
return BAD_CONFIG_FILE;
}
if (NULL == cfg_filename)
@@ -825,8 +827,10 @@ main (int argc,
cfg_filename))
{
TALER_LOG_ERROR ("Could not parse configuration\n");
+ GNUNET_free (cfg_filename);
return BAD_CONFIG_FILE;
}
+ GNUNET_free (cfg_filename);
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string (cfg,
"taler",
@@ -839,6 +843,16 @@ main (int argc,
GNUNET_CONFIGURATION_destroy (cfg);
return BAD_CONFIG_FILE;
}
+
+ if (strlen (currency) >= TALER_CURRENCY_LEN)
+ {
+ GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
+ "taler",
+ "CURRENCY",
+ "Value is too long");
+ GNUNET_CONFIGURATION_destroy (cfg);
+ return BAD_CONFIG_FILE;
+ }
if (howmany_clients > 10240)
{
TALER_LOG_ERROR ("-p option value given is too large\n");
@@ -950,11 +964,11 @@ main (int argc,
return BAD_CONFIG_FILE;
}
}
- GNUNET_CONFIGURATION_destroy (cfg);
result = parallel_benchmark (&run,
NULL,
cfg_filename);
+ GNUNET_CONFIGURATION_destroy (cfg);
/* If we're the exchange worker, we're done now. No need to print results */
if (MODE_EXCHANGE == mode)