exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit 89c7ed4bd3d13232bf651c9d1b5420c064b50233
parent 8161623b60259b79d85d25b1f846cc084d7cc061
Author: Christian Grothoff <grothoff@gnunet.org>
Date:   Wed,  1 Jul 2026 16:53:33 +0200

fix #11593

Diffstat:
Msrc/exchangedb/helper.h | 17+++++++++--------
Msrc/exchangedb/pg.c | 14+++++++-------
2 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/src/exchangedb/helper.h b/src/exchangedb/helper.h @@ -88,12 +88,6 @@ struct TALER_EXCHANGEDB_PostgresContext const char *transaction_name; /** - * Counts how often we have established a fresh @e conn - * to the database. Used to re-prepare statements. - */ - unsigned long long prep_gen; - - /** * Number of purses we allow to be opened concurrently * for one year per annual fee payment. */ @@ -103,6 +97,13 @@ struct TALER_EXCHANGEDB_PostgresContext /** + * Counts how often we have established a fresh @e conn + * to the database. Used to re-prepare statements. + */ +extern unsigned long long TEH_PG_prep_gen_; + + +/** * Prepares SQL statement @a sql under @a name for * connection @a pg once. * Returns with #GNUNET_DB_STATUS_HARD_ERROR on failure. @@ -125,7 +126,7 @@ struct TALER_EXCHANGEDB_PostgresContext off_++; \ GNUNET_assert (off_ < \ sizeof(preps_) / sizeof(*preps_)); \ - if (preps_[off_].cnt < pg->prep_gen) \ + if (preps_[off_].cnt < TEH_PG_prep_gen_) \ { \ struct GNUNET_PQ_PreparedStatement ps[] = { \ GNUNET_PQ_make_prepare (name, sql), \ @@ -140,7 +141,7 @@ struct TALER_EXCHANGEDB_PostgresContext return GNUNET_DB_STATUS_HARD_ERROR; \ } \ preps_[off_].pg = pg; \ - preps_[off_].cnt = pg->prep_gen; \ + preps_[off_].cnt = TEH_PG_prep_gen_; \ } \ } while (0) diff --git a/src/exchangedb/pg.c b/src/exchangedb/pg.c @@ -40,6 +40,11 @@ struct TALER_EXCHANGEDB_PostgresContext; */ #define AUTO_EXPLAIN 0 +/** + * Counts how often we have established a fresh @e conn + * to the database. Used to re-prepare statements. + */ +unsigned long long TEH_PG_prep_gen_; /** * Function called each time we connect or reconnect to the @@ -92,7 +97,7 @@ reconnect_cb (struct TALER_EXCHANGEDB_PostgresContext *pg, GNUNET_break (0); return; } - pg->prep_gen++; + TEH_PG_prep_gen_++; } @@ -115,12 +120,7 @@ internal_setup (struct TALER_EXCHANGEDB_PostgresContext *pg) pg); if (NULL == db_conn) return GNUNET_SYSERR; - if (0 == pg->prep_gen) - { - GNUNET_PQ_disconnect (db_conn); - return GNUNET_SYSERR; - } - if (0 == pg->prep_gen) + if (0 == TEH_PG_prep_gen_) { GNUNET_PQ_disconnect (db_conn); return GNUNET_SYSERR;