From b87ad62692d9e0235554fecc52862cfca128dfe8 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 22 Nov 2023 22:23:45 +0100 Subject: -fix minor threading issue --- src/bank-lib/fakebank_tbr_get_history.c | 4 +++- src/bank-lib/fakebank_twg_history.c | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/bank-lib/fakebank_tbr_get_history.c b/src/bank-lib/fakebank_tbr_get_history.c index 4653c505b..7e7f9dda2 100644 --- a/src/bank-lib/fakebank_tbr_get_history.c +++ b/src/bank-lib/fakebank_tbr_get_history.c @@ -61,6 +61,7 @@ TALER_FAKEBANK_tbr_get_history_incoming ( const struct Transaction *pos; enum GNUNET_GenericReturnValue ret; bool in_shutdown; + const char *acc_payto_uri; if (NULL == cc) { @@ -269,6 +270,7 @@ TALER_FAKEBANK_tbr_get_history_incoming ( return MHD_YES; } in_shutdown = h->in_shutdown; + acc_payto_uri = hc->acc->payto_uri; GNUNET_assert (0 == pthread_mutex_unlock (&h->big_lock)); finish: @@ -291,7 +293,7 @@ finish: MHD_HTTP_OK, GNUNET_JSON_pack_string ( "credit_account", - hc->acc->payto_uri), + acc_payto_uri), GNUNET_JSON_pack_array_steal ( "incoming_transactions", h)); diff --git a/src/bank-lib/fakebank_twg_history.c b/src/bank-lib/fakebank_twg_history.c index 6bed3cdf0..c75b5c88b 100644 --- a/src/bank-lib/fakebank_twg_history.c +++ b/src/bank-lib/fakebank_twg_history.c @@ -307,6 +307,8 @@ TALER_FAKEBANK_twg_get_credit_history_ ( struct HistoryContext *hc; const struct Transaction *pos; enum GNUNET_GenericReturnValue ret; + bool in_shutdown; + const char *acc_payto_uri; if (NULL == cc) { @@ -493,12 +495,14 @@ TALER_FAKEBANK_twg_get_credit_history_ ( pthread_mutex_unlock (&h->big_lock)); return MHD_YES; } + in_shutdown = h->in_shutdown; + acc_payto_uri = hc->acc->payto_uri; GNUNET_assert (0 == pthread_mutex_unlock (&h->big_lock)); finish: if (0 == json_array_size (hc->history)) { - GNUNET_break (h->in_shutdown || + GNUNET_break (in_shutdown || (! GNUNET_TIME_absolute_is_future (hc->timeout))); return TALER_MHD_reply_static (connection, MHD_HTTP_NO_CONTENT, @@ -515,7 +519,7 @@ finish: MHD_HTTP_OK, GNUNET_JSON_pack_string ( "credit_account", - hc->acc->payto_uri), + acc_payto_uri), GNUNET_JSON_pack_array_steal ( "incoming_transactions", h)); -- cgit v1.2.3