summaryrefslogtreecommitdiff
path: root/src/exchangedb
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-10-22 14:46:52 +0200
committerChristian Grothoff <christian@grothoff.org>2022-10-22 14:46:52 +0200
commitcedcde4939d560783286b533d01fbe6163dc5766 (patch)
treecc2ce21bf7f10453859dcb0ab2fa86abbb98567e /src/exchangedb
parentc4bbc4ac566c3e5f32f40b0db6326bfa68e756c9 (diff)
downloadexchange-cedcde4939d560783286b533d01fbe6163dc5766.tar.gz
exchange-cedcde4939d560783286b533d01fbe6163dc5766.tar.bz2
exchange-cedcde4939d560783286b533d01fbe6163dc5766.zip
fix taler-auditor-sync: needs two plugins running in parallel with their own prepare counters
Diffstat (limited to 'src/exchangedb')
-rw-r--r--src/exchangedb/pg_helper.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/exchangedb/pg_helper.h b/src/exchangedb/pg_helper.h
index 3e9ce7b4c..4b5859662 100644
--- a/src/exchangedb/pg_helper.h
+++ b/src/exchangedb/pg_helper.h
@@ -108,9 +108,19 @@ struct PostgresClosure
*/
#define PREPARE(pg,name,sql) \
do { \
- static unsigned long long prep_cnt; \
+ static struct { \
+ unsigned long long cnt; \
+ struct PostgresClosure *pg; \
+ } preps[2]; /* 2 ctrs for taler-auditor-sync*/ \
+ unsigned int off = 0; \
\
- if (prep_cnt < pg->prep_gen) \
+ while ( (NULL != preps[off].pg) && \
+ (pg != preps[off].pg) && \
+ (off < sizeof(preps) / sizeof(*preps)) ) \
+ off++; \
+ GNUNET_assert (off < \
+ sizeof(preps) / sizeof(*preps)); \
+ if (preps[off].cnt < pg->prep_gen) \
{ \
struct GNUNET_PQ_PreparedStatement ps[] = { \
GNUNET_PQ_make_prepare (name, sql), \
@@ -124,7 +134,8 @@ struct PostgresClosure
GNUNET_break (0); \
return GNUNET_DB_STATUS_HARD_ERROR; \
} \
- prep_cnt = pg->prep_gen; \
+ preps[off].pg = pg; \
+ preps[off].cnt = pg->prep_gen; \
} \
} while (0)