summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-03-04 11:12:23 +0100
committerChristian Grothoff <christian@grothoff.org>2021-03-04 11:12:23 +0100
commit9f9d2470b6363fc1070fe3004154e65746cd9ea5 (patch)
tree53b8ab557f9e1b3ef378769c3db3b1b41140cf78
parentb21ae427f405ac4e54aba8aa5f6f2dcfa175a525 (diff)
downloadmerchant-9f9d2470b6363fc1070fe3004154e65746cd9ea5.tar.gz
merchant-9f9d2470b6363fc1070fe3004154e65746cd9ea5.tar.bz2
merchant-9f9d2470b6363fc1070fe3004154e65746cd9ea5.zip
-more logic cleanup, no semantic change
-rw-r--r--src/backend/taler-merchant-httpd_post-tips-ID-pickup.c39
-rw-r--r--src/backenddb/plugin_merchantdb_postgres.c11
2 files changed, 23 insertions, 27 deletions
diff --git a/src/backend/taler-merchant-httpd_post-tips-ID-pickup.c b/src/backend/taler-merchant-httpd_post-tips-ID-pickup.c
index 4809fee8..c97c7587 100644
--- a/src/backend/taler-merchant-httpd_post-tips-ID-pickup.c
+++ b/src/backend/taler-merchant-httpd_post-tips-ID-pickup.c
@@ -803,8 +803,7 @@ RETRY:
memset (sigs,
0,
- sizeof (struct GNUNET_CRYPTO_RsaSignature *)
- * GNUNET_NZL (pc->planchets_length));
+ sizeof (sigs));
qs = TMH_db->lookup_pickup (TMH_db->cls,
hc->instance->settings.id,
&pc->tip_id,
@@ -821,29 +820,28 @@ RETRY:
for (unsigned int i = 0; i< pc->planchets_length; i++)
{
- if (NULL == sigs[i])
+ if (NULL != sigs[i])
+ continue;
+ if (! rollback)
{
- if (! rollback)
- {
- TMH_db->rollback (TMH_db->cls);
- MHD_suspend_connection (connection);
- GNUNET_CONTAINER_DLL_insert (pc_head,
- pc_tail,
- pc);
- pc->tt = GNUNET_SCHEDULER_add_delayed (EXCHANGE_TIMEOUT,
- &do_timeout,
- pc);
- rollback = true;
- }
- try_withdraw (pc,
- exchange_url,
- &pc->planchets[i],
- i);
- qs = GNUNET_DB_STATUS_SUCCESS_NO_RESULTS;
+ TMH_db->rollback (TMH_db->cls);
+ MHD_suspend_connection (connection);
+ GNUNET_CONTAINER_DLL_insert (pc_head,
+ pc_tail,
+ pc);
+ pc->tt = GNUNET_SCHEDULER_add_delayed (EXCHANGE_TIMEOUT,
+ &do_timeout,
+ pc);
+ rollback = true;
}
+ try_withdraw (pc,
+ exchange_url,
+ &pc->planchets[i],
+ i);
}
if (rollback)
return MHD_YES;
+ /* we got _all_ signatures, can continue! */
}
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS != qs)
{
@@ -879,7 +877,6 @@ RETRY:
break;
case GNUNET_DB_STATUS_SOFT_ERROR:
goto RETRY;
- break;
case GNUNET_DB_STATUS_HARD_ERROR:
ec = TALER_EC_GENERIC_DB_FETCH_FAILED;
response_code = MHD_HTTP_INTERNAL_SERVER_ERROR;
diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c
index a1b659db..f4394a7e 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -617,7 +617,8 @@ postgres_insert_instance (void *cls,
const struct TALER_MerchantPublicKeyP *merchant_pub,
const struct TALER_MerchantPrivateKeyP *merchant_priv,
const struct TALER_MERCHANTDB_InstanceSettings *is,
- const struct TALER_MERCHANTDB_InstanceAuthSettings *ias)
+ const struct
+ TALER_MERCHANTDB_InstanceAuthSettings *ias)
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
@@ -769,6 +770,7 @@ postgres_update_instance (void *cls,
params);
}
+
/**
* Update information about an instance's authentication settings
* into our database.
@@ -780,7 +782,8 @@ postgres_update_instance (void *cls,
static enum GNUNET_DB_QueryStatus
postgres_update_instance_auth (void *cls,
const char *merchant_id,
- const struct TALER_MERCHANTDB_InstanceAuthSettings *is)
+ const struct
+ TALER_MERCHANTDB_InstanceAuthSettings *is)
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
@@ -5600,7 +5603,6 @@ postgres_lookup_tip (void *cls,
GNUNET_PQ_result_spec_end
};
- check_connection (pg);
return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
"lookup_tip",
params,
@@ -5954,7 +5956,6 @@ postgres_insert_pickup (void *cls,
GNUNET_PQ_query_param_end
};
- check_connection (pg);
qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
"insert_pickup",
params);
@@ -5969,7 +5970,6 @@ postgres_insert_pickup (void *cls,
GNUNET_PQ_query_param_end
};
- check_connection (pg);
qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
"update_picked_up_tip",
params);
@@ -6017,7 +6017,6 @@ postgres_insert_pickup (void *cls,
GNUNET_PQ_query_param_end
};
- check_connection (pg);
qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
"update_picked_up_reserve",
params);