From a166ca7fece8bbe3c66dcf0217cc81d20d185ab0 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 12 Mar 2018 11:33:10 +0100 Subject: fix #5281 for exchange: do preflight check that an old transaction is no longer running by accident --- src/include/taler_exchangedb_plugin.h | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/include/taler_exchangedb_plugin.h') diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h index ae38856a3..33677559a 100644 --- a/src/include/taler_exchangedb_plugin.h +++ b/src/include/taler_exchangedb_plugin.h @@ -1152,11 +1152,14 @@ struct TALER_EXCHANGEDB_Plugin * * @param cls the @e cls of this struct with the plugin-specific state * @param session connection to use + * @param name unique name identifying the transaction (for debugging), + * must point to a constant * @return #GNUNET_OK on success */ int (*start) (void *cls, - struct TALER_EXCHANGEDB_Session *session); + struct TALER_EXCHANGEDB_Session *session, + const char *name); /** @@ -1171,6 +1174,19 @@ struct TALER_EXCHANGEDB_Plugin struct TALER_EXCHANGEDB_Session *session); + /** + * Do a pre-flight check that we are not in an uncommitted transaction. + * If we are, try to commit the previous transaction and output a warning. + * Does not return anything, as we will continue regardless of the outcome. + * + * @param cls the `struct PostgresClosure` with the plugin-specific state + * @param session the database connection + */ + void + (*preflight) (void *cls, + struct TALER_EXCHANGEDB_Session *session); + + /** * Abort/rollback a transaction. * @@ -1397,7 +1413,7 @@ struct TALER_EXCHANGEDB_Plugin const struct TALER_CoinSpendPublicKeyP *coin_pub, TALER_EXCHANGEDB_RefundCoinCallback cb, void *cb_cls); - + /** * Mark a deposit as tiny, thereby declaring that it cannot be -- cgit v1.2.3