summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-03-07 10:53:29 +0100
committerChristian Grothoff <christian@grothoff.org>2024-03-07 10:53:29 +0100
commitb92034e1a934e545f0d9967cf1ebba85f88fa51f (patch)
treee6e380999258ff5097c67a8c5c7e1b2059737e45
parent30f7464145726c68e3f104519b7ce11debf7fe64 (diff)
downloadexchange-b92034e1a934e545f0d9967cf1ebba85f88fa51f.tar.gz
exchange-b92034e1a934e545f0d9967cf1ebba85f88fa51f.tar.bz2
exchange-b92034e1a934e545f0d9967cf1ebba85f88fa51f.zip
remove unnecessary operations from global lock scope
-rw-r--r--src/bank-lib/fakebank_tbr_get_history.c17
-rw-r--r--src/bank-lib/fakebank_twg_history.c17
2 files changed, 14 insertions, 20 deletions
diff --git a/src/bank-lib/fakebank_tbr_get_history.c b/src/bank-lib/fakebank_tbr_get_history.c
index e318a2af9..a6cfaad8d 100644
--- a/src/bank-lib/fakebank_tbr_get_history.c
+++ b/src/bank-lib/fakebank_tbr_get_history.c
@@ -70,7 +70,12 @@ TALER_FAKEBANK_tbr_get_history (
*con_cls = cc;
hc = GNUNET_new (struct HistoryContext);
cc->ctx = hc;
-
+ hc->history = json_array ();
+ if (NULL == hc->history)
+ {
+ GNUNET_break (0);
+ return MHD_NO;
+ }
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Handling /accounts/%s/taler-revenue/history request\n",
account);
@@ -82,6 +87,7 @@ TALER_FAKEBANK_tbr_get_history (
GNUNET_break_op (0);
return (GNUNET_SYSERR == ret) ? MHD_NO : MHD_YES;
}
+ hc->timeout = GNUNET_TIME_relative_to_absolute (hc->ha.lp_timeout);
GNUNET_assert (0 ==
pthread_mutex_lock (&h->big_lock));
if (UINT64_MAX == hc->ha.start_idx)
@@ -101,15 +107,6 @@ TALER_FAKEBANK_tbr_get_history (
TALER_EC_BANK_UNKNOWN_ACCOUNT,
account);
}
- hc->history = json_array ();
- if (NULL == hc->history)
- {
- GNUNET_break (0);
- GNUNET_assert (0 ==
- pthread_mutex_unlock (&h->big_lock));
- return MHD_NO;
- }
- hc->timeout = GNUNET_TIME_relative_to_absolute (hc->ha.lp_timeout);
}
else
{
diff --git a/src/bank-lib/fakebank_twg_history.c b/src/bank-lib/fakebank_twg_history.c
index c10358c1a..6d3c376e5 100644
--- a/src/bank-lib/fakebank_twg_history.c
+++ b/src/bank-lib/fakebank_twg_history.c
@@ -325,7 +325,12 @@ TALER_FAKEBANK_twg_get_credit_history_ (
*con_cls = cc;
hc = GNUNET_new (struct HistoryContext);
cc->ctx = hc;
-
+ hc->history = json_array ();
+ if (NULL == hc->history)
+ {
+ GNUNET_break (0);
+ return MHD_NO;
+ }
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Handling /history/incoming connection %p\n",
connection);
@@ -337,6 +342,7 @@ TALER_FAKEBANK_twg_get_credit_history_ (
GNUNET_break_op (0);
return (GNUNET_SYSERR == ret) ? MHD_NO : MHD_YES;
}
+ hc->timeout = GNUNET_TIME_relative_to_absolute (hc->ha.lp_timeout);
GNUNET_assert (0 ==
pthread_mutex_lock (&h->big_lock));
if (UINT64_MAX == hc->ha.start_idx)
@@ -353,15 +359,6 @@ TALER_FAKEBANK_twg_get_credit_history_ (
TALER_EC_BANK_UNKNOWN_ACCOUNT,
account);
}
- hc->history = json_array ();
- if (NULL == hc->history)
- {
- GNUNET_break (0);
- GNUNET_assert (0 ==
- pthread_mutex_unlock (&h->big_lock));
- return MHD_NO;
- }
- hc->timeout = GNUNET_TIME_relative_to_absolute (hc->ha.lp_timeout);
}
else
{