diff options
Diffstat (limited to 'src/exchange/taler-exchange-httpd_db.c')
-rw-r--r-- | src/exchange/taler-exchange-httpd_db.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/src/exchange/taler-exchange-httpd_db.c b/src/exchange/taler-exchange-httpd_db.c index 8574224af..3c6936497 100644 --- a/src/exchange/taler-exchange-httpd_db.c +++ b/src/exchange/taler-exchange-httpd_db.c | |||
@@ -45,21 +45,18 @@ | |||
45 | * | 45 | * |
46 | * @param coin the coin to make known | 46 | * @param coin the coin to make known |
47 | * @param connection MHD request context | 47 | * @param connection MHD request context |
48 | * @param session database session and transaction to use | ||
49 | * @param[out] mhd_ret set to MHD status on error | 48 | * @param[out] mhd_ret set to MHD status on error |
50 | * @return transaction status, negative on error (@a mhd_ret will be set in this case) | 49 | * @return transaction status, negative on error (@a mhd_ret will be set in this case) |
51 | */ | 50 | */ |
52 | enum GNUNET_DB_QueryStatus | 51 | enum GNUNET_DB_QueryStatus |
53 | TEH_make_coin_known (const struct TALER_CoinPublicInfo *coin, | 52 | TEH_make_coin_known (const struct TALER_CoinPublicInfo *coin, |
54 | struct MHD_Connection *connection, | 53 | struct MHD_Connection *connection, |
55 | struct TALER_EXCHANGEDB_Session *session, | ||
56 | MHD_RESULT *mhd_ret) | 54 | MHD_RESULT *mhd_ret) |
57 | { | 55 | { |
58 | enum TALER_EXCHANGEDB_CoinKnownStatus cks; | 56 | enum TALER_EXCHANGEDB_CoinKnownStatus cks; |
59 | 57 | ||
60 | /* make sure coin is 'known' in database */ | 58 | /* make sure coin is 'known' in database */ |
61 | cks = TEH_plugin->ensure_coin_known (TEH_plugin->cls, | 59 | cks = TEH_plugin->ensure_coin_known (TEH_plugin->cls, |
62 | session, | ||
63 | coin); | 60 | coin); |
64 | switch (cks) | 61 | switch (cks) |
65 | { | 62 | { |
@@ -85,7 +82,6 @@ TEH_make_coin_known (const struct TALER_CoinPublicInfo *coin, | |||
85 | enum GNUNET_DB_QueryStatus qs; | 82 | enum GNUNET_DB_QueryStatus qs; |
86 | 83 | ||
87 | qs = TEH_plugin->get_coin_transactions (TEH_plugin->cls, | 84 | qs = TEH_plugin->get_coin_transactions (TEH_plugin->cls, |
88 | session, | ||
89 | &coin->coin_pub, | 85 | &coin->coin_pub, |
90 | GNUNET_NO, | 86 | GNUNET_NO, |
91 | &tl); | 87 | &tl); |
@@ -135,11 +131,10 @@ TEH_DB_run_transaction (struct MHD_Connection *connection, | |||
135 | TEH_DB_TransactionCallback cb, | 131 | TEH_DB_TransactionCallback cb, |
136 | void *cb_cls) | 132 | void *cb_cls) |
137 | { | 133 | { |
138 | struct TALER_EXCHANGEDB_Session *session; | ||
139 | |||
140 | if (NULL != mhd_ret) | 134 | if (NULL != mhd_ret) |
141 | *mhd_ret = -1; /* set to invalid value, to help detect bugs */ | 135 | *mhd_ret = -1; /* set to invalid value, to help detect bugs */ |
142 | if (NULL == (session = TEH_plugin->get_session (TEH_plugin->cls))) | 136 | if (GNUNET_OK != |
137 | TEH_plugin->preflight (TEH_plugin->cls)) | ||
143 | { | 138 | { |
144 | GNUNET_break (0); | 139 | GNUNET_break (0); |
145 | if (NULL != mhd_ret) | 140 | if (NULL != mhd_ret) |
@@ -157,7 +152,6 @@ TEH_DB_run_transaction (struct MHD_Connection *connection, | |||
157 | 152 | ||
158 | if (GNUNET_OK != | 153 | if (GNUNET_OK != |
159 | TEH_plugin->start (TEH_plugin->cls, | 154 | TEH_plugin->start (TEH_plugin->cls, |
160 | session, | ||
161 | name)) | 155 | name)) |
162 | { | 156 | { |
163 | GNUNET_break (0); | 157 | GNUNET_break (0); |
@@ -170,16 +164,13 @@ TEH_DB_run_transaction (struct MHD_Connection *connection, | |||
170 | } | 164 | } |
171 | qs = cb (cb_cls, | 165 | qs = cb (cb_cls, |
172 | connection, | 166 | connection, |
173 | session, | ||
174 | mhd_ret); | 167 | mhd_ret); |
175 | if (0 > qs) | 168 | if (0 > qs) |
176 | TEH_plugin->rollback (TEH_plugin->cls, | 169 | TEH_plugin->rollback (TEH_plugin->cls); |
177 | session); | ||
178 | if (GNUNET_DB_STATUS_HARD_ERROR == qs) | 170 | if (GNUNET_DB_STATUS_HARD_ERROR == qs) |
179 | return GNUNET_SYSERR; | 171 | return GNUNET_SYSERR; |
180 | if (0 <= qs) | 172 | if (0 <= qs) |
181 | qs = TEH_plugin->commit (TEH_plugin->cls, | 173 | qs = TEH_plugin->commit (TEH_plugin->cls); |
182 | session); | ||
183 | if (GNUNET_DB_STATUS_HARD_ERROR == qs) | 174 | if (GNUNET_DB_STATUS_HARD_ERROR == qs) |
184 | { | 175 | { |
185 | if (NULL != mhd_ret) | 176 | if (NULL != mhd_ret) |