aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bank-lib/bank_api_transfer.c1
-rw-r--r--src/bank-lib/fakebank.c1
-rw-r--r--src/benchmark/benchmark.conf20
-rw-r--r--src/benchmark/taler-aggregator-benchmark.c4
-rw-r--r--src/exchange/taler-exchange-transfer.c81
5 files changed, 76 insertions, 31 deletions
diff --git a/src/bank-lib/bank_api_transfer.c b/src/bank-lib/bank_api_transfer.c
index da9ff4f55..7b8c74b24 100644
--- a/src/bank-lib/bank_api_transfer.c
+++ b/src/bank-lib/bank_api_transfer.c
@@ -357,7 +357,6 @@ TALER_BANK_transfer (
return NULL;
}
json_decref (transfer_obj);
-
th->job = GNUNET_CURL_job_add2 (ctx,
eh,
th->post_ctx.headers,
diff --git a/src/bank-lib/fakebank.c b/src/bank-lib/fakebank.c
index eb6f4c79c..6a6278ed5 100644
--- a/src/bank-lib/fakebank.c
+++ b/src/bank-lib/fakebank.c
@@ -988,6 +988,7 @@ make_transfer (
return GNUNET_SYSERR;
}
*ret_row_id = t->row_id;
+ *timestamp = t->date;
GNUNET_assert (0 ==
pthread_mutex_unlock (&h->uuid_map_lock));
return GNUNET_OK;
diff --git a/src/benchmark/benchmark.conf b/src/benchmark/benchmark.conf
index c38981dd6..5199ee872 100644
--- a/src/benchmark/benchmark.conf
+++ b/src/benchmark/benchmark.conf
@@ -54,28 +54,20 @@ MAX_DEBT_BANK = EUR:1000000000000000.0
[benchmark]
USER_PAYTO_URI = payto://x-taler-bank/localhost:8082/42
-[exchange-account-2]
-# What is the payto://-URL of the exchange (to generate wire response)
-PAYTO_URI = "payto://x-taler-bank/localhost:8082/Exchange"
+[exchange-account-test]
+# What is the bank account (with the "Taler Bank" demo system)? Must end with "/".
+PAYTO_URI = "payto://x-taler-bank/localhost/Exchange"
+# Authentication information for basic authentication
ENABLE_DEBIT = YES
ENABLE_CREDIT = YES
-[exchange-accountcredentials-2]
-# What is the bank account (with the "Taler Bank" demo system)? Must end with "/".
-WIRE_GATEWAY_URL = http://localhost:8082/taler-wire-gateway/Exchange/
-# Authentication information for basic authentication
+[exchange-accountcredentials-test]
+WIRE_GATEWAY_URL = http://localhost:8082/Exchange/
WIRE_GATEWAY_AUTH_METHOD = "basic"
USERNAME = Exchange
PASSWORD = x
-[exchange-account-aggregator]
-# What is the payto://-URL of the exchange (to generate wire response)
-PAYTO_URI = "payto://aggregator-benchmark/exchangeacc"
-ENABLE_DEBIT = YES
-
-
-
# Sections starting with "coin_" specify which denominations
# the exchange should support (and their respective fee structure)
[coin_eur_ct_1]
diff --git a/src/benchmark/taler-aggregator-benchmark.c b/src/benchmark/taler-aggregator-benchmark.c
index 283ee23ba..e432d8f57 100644
--- a/src/benchmark/taler-aggregator-benchmark.c
+++ b/src/benchmark/taler-aggregator-benchmark.c
@@ -370,7 +370,7 @@ work (void *cls)
rnd2 = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_NONCE,
UINT64_MAX);
GNUNET_asprintf (&acc,
- "payto://aggregator-benchmark/account-%llX-%llX",
+ "payto://x-taler-bank/localhost:8082/account-%llX-%llX",
(unsigned long long) rnd1,
(unsigned long long) rnd2);
json_wire = GNUNET_JSON_PACK (
@@ -548,7 +548,7 @@ run (void *cls,
sizeof (master_sig));
if (0 >
plugin->insert_wire_fee (plugin->cls,
- "aggregator-benchmark",
+ "x-taler-bank",
ws,
we,
&wire_fee,
diff --git a/src/exchange/taler-exchange-transfer.c b/src/exchange/taler-exchange-transfer.c
index 46093d89c..f3bd16da7 100644
--- a/src/exchange/taler-exchange-transfer.c
+++ b/src/exchange/taler-exchange-transfer.c
@@ -33,6 +33,11 @@
*/
#define MAXIMUM_BATCH_SIZE 1024
+/**
+ * How often will we retry a request (given certain
+ * HTTP status codes) before giving up?
+ */
+#define MAX_RETRIES 16
/**
* Information about our work shard.
@@ -104,6 +109,17 @@ struct WirePrepareData
*/
unsigned long long row_id;
+ /**
+ * Number of bytes allocated after this struct
+ * with the prewire data.
+ */
+ size_t buf_size;
+
+ /**
+ * How often did we retry so far?
+ */
+ unsigned int retries;
+
};
@@ -217,16 +233,6 @@ static void
shutdown_task (void *cls)
{
(void) cls;
- if (NULL != ctx)
- {
- GNUNET_CURL_fini (ctx);
- ctx = NULL;
- }
- if (NULL != rc)
- {
- GNUNET_CURL_gnunet_rc_destroy (rc);
- rc = NULL;
- }
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Running shutdown\n");
if (NULL != task)
@@ -241,6 +247,16 @@ shutdown_task (void *cls)
db_plugin = NULL;
TALER_EXCHANGEDB_unload_accounts ();
cfg = NULL;
+ if (NULL != ctx)
+ {
+ GNUNET_CURL_fini (ctx);
+ ctx = NULL;
+ }
+ if (NULL != rc)
+ {
+ GNUNET_CURL_gnunet_rc_destroy (rc);
+ rc = NULL;
+ }
}
@@ -410,6 +426,36 @@ wire_confirm_cb (void *cls,
wpd->row_id);
/* continued below */
break;
+ case 0:
+ case MHD_HTTP_TOO_MANY_REQUESTS:
+ case MHD_HTTP_INTERNAL_SERVER_ERROR:
+ case MHD_HTTP_BAD_GATEWAY:
+ case MHD_HTTP_SERVICE_UNAVAILABLE:
+ case MHD_HTTP_GATEWAY_TIMEOUT:
+ wpd->retries++;
+ if (wpd->retries < MAX_RETRIES)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Wire transfer %llu failed (%u), trying again\n",
+ (unsigned long long) wpd->row_id,
+ http_status_code);
+ wpd->eh = TALER_BANK_transfer (ctx,
+ wpd->wa->auth,
+ &wpd[1],
+ wpd->buf_size,
+ &wire_confirm_cb,
+ wpd);
+ return;
+ }
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Wire transaction %llu failed: %u/%d\n",
+ (unsigned long long) wpd->row_id,
+ http_status_code,
+ ec);
+ db_plugin->rollback (db_plugin->cls);
+ global_ret = EXIT_FAILURE;
+ GNUNET_SCHEDULER_shutdown ();
+ return;
default:
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Wire transfer %llu failed: %u/%d\n",
@@ -469,7 +515,6 @@ wire_prepare_cb (void *cls,
const char *buf,
size_t buf_size)
{
- const struct TALER_EXCHANGEDB_AccountInfo *wa;
struct WirePrepareData *wpd;
(void) cls;
@@ -491,7 +536,12 @@ wire_prepare_cb (void *cls,
GNUNET_SCHEDULER_shutdown ();
return;
}
- wpd = GNUNET_new (struct WirePrepareData);
+ wpd = GNUNET_malloc (sizeof (struct WirePrepareData)
+ + buf_size);
+ memcpy (&wpd[1],
+ buf,
+ buf_size);
+ wpd->buf_size = buf_size;
wpd->row_id = rowid;
GNUNET_CONTAINER_DLL_insert (wpd_head,
wpd_tail,
@@ -510,9 +560,8 @@ wire_prepare_cb (void *cls,
GNUNET_SCHEDULER_shutdown ();
return;
}
- wa = wpd->wa;
wpd->eh = TALER_BANK_transfer (ctx,
- wa->auth,
+ wpd->wa->auth,
buf,
buf_size,
&wire_confirm_cb,
@@ -580,6 +629,10 @@ run_transfers (void *cls)
NULL);
return;
}
+ /* cap number of parallel connections to a reasonable
+ limit for concurrent requests to the bank */
+ limit = GNUNET_MIN (limit,
+ 256);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Checking for %lld pending wire transfers [%llu-...)\n",
(long long) limit,