diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-06-23 13:16:12 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-06-23 13:16:12 +0200 |
commit | d4884c0c605db10934f7bb378072a21ecb523d12 (patch) | |
tree | 83f76763a41b1b85dc44413f6fd0c3b5134bea98 /src/exchange/taler-exchange-httpd_db.c | |
parent | fbff951e7d0a8965c44e37716067d5ddc13c975a (diff) | |
download | exchange-d4884c0c605db10934f7bb378072a21ecb523d12.tar.gz exchange-d4884c0c605db10934f7bb378072a21ecb523d12.tar.bz2 exchange-d4884c0c605db10934f7bb378072a21ecb523d12.zip |
Fix #5010 for keystate
Diffstat (limited to 'src/exchange/taler-exchange-httpd_db.c')
-rw-r--r-- | src/exchange/taler-exchange-httpd_db.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/exchange/taler-exchange-httpd_db.c b/src/exchange/taler-exchange-httpd_db.c index 9eeda6ee0..f2e1f7b39 100644 --- a/src/exchange/taler-exchange-httpd_db.c +++ b/src/exchange/taler-exchange-httpd_db.c @@ -54,12 +54,14 @@ TEH_DB_run_transaction (struct MHD_Connection *connection, { struct TALER_EXCHANGEDB_Session *session; - *mhd_ret = -1; /* invalid value */ + if (NULL != mhd_ret) + *mhd_ret = -1; /* invalid value */ if (NULL == (session = TEH_plugin->get_session (TEH_plugin->cls))) { GNUNET_break (0); - *mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection, - TALER_EC_DB_SETUP_FAILED); + if (NULL != mhd_ret) + *mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection, + TALER_EC_DB_SETUP_FAILED); return GNUNET_SYSERR; } for (unsigned int retries = 0;retries < MAX_TRANSACTION_COMMIT_RETRIES; retries++) @@ -70,9 +72,10 @@ TEH_DB_run_transaction (struct MHD_Connection *connection, TEH_plugin->start (TEH_plugin->cls, session)) { - GNUNET_break (0); - *mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection, - TALER_EC_DB_START_FAILED); + GNUNET_break (0); + if (NULL != mhd_ret) + *mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection, + TALER_EC_DB_START_FAILED); return GNUNET_SYSERR; } qs = cb (cb_cls, @@ -89,19 +92,22 @@ TEH_DB_run_transaction (struct MHD_Connection *connection, session); if (GNUNET_DB_STATUS_HARD_ERROR == qs) { - *mhd_ret = TEH_RESPONSE_reply_commit_error (connection, - TALER_EC_DB_COMMIT_FAILED_HARD); + if (NULL != mhd_ret) + *mhd_ret = TEH_RESPONSE_reply_commit_error (connection, + TALER_EC_DB_COMMIT_FAILED_HARD); return GNUNET_SYSERR; } /* make sure callback did not violate invariants! */ - GNUNET_assert (-1 == *mhd_ret); + GNUNET_assert ( (NULL == mhd_ret) || + (-1 == *mhd_ret) ); if (0 <= qs) return GNUNET_OK; } TALER_LOG_WARNING ("Transaction commit failed %u times\n", MAX_TRANSACTION_COMMIT_RETRIES); - *mhd_ret = TEH_RESPONSE_reply_commit_error (connection, - TALER_EC_DB_COMMIT_FAILED_ON_RETRY); + if (NULL != mhd_ret) + *mhd_ret = TEH_RESPONSE_reply_commit_error (connection, + TALER_EC_DB_COMMIT_FAILED_ON_RETRY); return GNUNET_SYSERR; } |