diff options
Diffstat (limited to 'src/auditor/report-lib.c')
-rw-r--r-- | src/auditor/report-lib.c | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/src/auditor/report-lib.c b/src/auditor/report-lib.c index 5f45d7198..0ae1cc1f6 100644 --- a/src/auditor/report-lib.c +++ b/src/auditor/report-lib.c | |||
@@ -42,11 +42,6 @@ struct TALER_Amount TALER_ARL_currency_round_unit; | |||
42 | const struct GNUNET_CONFIGURATION_Handle *TALER_ARL_cfg; | 42 | const struct GNUNET_CONFIGURATION_Handle *TALER_ARL_cfg; |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * Our session with the #TALER_ARL_edb. | ||
46 | */ | ||
47 | struct TALER_EXCHANGEDB_Session *TALER_ARL_esession; | ||
48 | |||
49 | /** | ||
50 | * Handle to access the auditor's database. | 45 | * Handle to access the auditor's database. |
51 | */ | 46 | */ |
52 | struct TALER_AUDITORDB_Plugin *TALER_ARL_adb; | 47 | struct TALER_AUDITORDB_Plugin *TALER_ARL_adb; |
@@ -213,7 +208,6 @@ TALER_ARL_get_denomination_info_by_hash ( | |||
213 | denominations = GNUNET_CONTAINER_multihashmap_create (256, | 208 | denominations = GNUNET_CONTAINER_multihashmap_create (256, |
214 | GNUNET_NO); | 209 | GNUNET_NO); |
215 | qs = TALER_ARL_edb->iterate_denomination_info (TALER_ARL_edb->cls, | 210 | qs = TALER_ARL_edb->iterate_denomination_info (TALER_ARL_edb->cls, |
216 | TALER_ARL_esession, | ||
217 | &add_denomination, | 211 | &add_denomination, |
218 | NULL); | 212 | NULL); |
219 | if (0 > qs) | 213 | if (0 > qs) |
@@ -239,7 +233,6 @@ TALER_ARL_get_denomination_info_by_hash ( | |||
239 | struct TALER_EXCHANGEDB_DenominationKeyInformationP issue; | 233 | struct TALER_EXCHANGEDB_DenominationKeyInformationP issue; |
240 | 234 | ||
241 | qs = TALER_ARL_edb->get_denomination_info (TALER_ARL_edb->cls, | 235 | qs = TALER_ARL_edb->get_denomination_info (TALER_ARL_edb->cls, |
242 | TALER_ARL_esession, | ||
243 | dh, | 236 | dh, |
244 | &issue); | 237 | &issue); |
245 | if (qs <= 0) | 238 | if (qs <= 0) |
@@ -324,23 +317,24 @@ transact (TALER_ARL_Analysis analysis, | |||
324 | GNUNET_break (0); | 317 | GNUNET_break (0); |
325 | return GNUNET_SYSERR; | 318 | return GNUNET_SYSERR; |
326 | } | 319 | } |
327 | TALER_ARL_edb->preflight (TALER_ARL_edb->cls, | 320 | if (GNUNET_OK != |
328 | TALER_ARL_esession); | 321 | TALER_ARL_edb->preflight (TALER_ARL_edb->cls)) |
322 | { | ||
323 | GNUNET_break (0); | ||
324 | return GNUNET_SYSERR; | ||
325 | } | ||
329 | ret = TALER_ARL_edb->start (TALER_ARL_edb->cls, | 326 | ret = TALER_ARL_edb->start (TALER_ARL_edb->cls, |
330 | TALER_ARL_esession, | ||
331 | "auditor"); | 327 | "auditor"); |
332 | if (GNUNET_OK != ret) | 328 | if (GNUNET_OK != ret) |
333 | { | 329 | { |
334 | GNUNET_break (0); | 330 | GNUNET_break (0); |
335 | TALER_ARL_edb->rollback (TALER_ARL_edb->cls, | 331 | TALER_ARL_edb->rollback (TALER_ARL_edb->cls); |
336 | TALER_ARL_esession); | ||
337 | return GNUNET_SYSERR; | 332 | return GNUNET_SYSERR; |
338 | } | 333 | } |
339 | qs = analysis (analysis_cls); | 334 | qs = analysis (analysis_cls); |
340 | if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs) | 335 | if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs) |
341 | { | 336 | { |
342 | qs = TALER_ARL_edb->commit (TALER_ARL_edb->cls, | 337 | qs = TALER_ARL_edb->commit (TALER_ARL_edb->cls); |
343 | TALER_ARL_esession); | ||
344 | if (0 > qs) | 338 | if (0 > qs) |
345 | { | 339 | { |
346 | GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); | 340 | GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); |
@@ -367,8 +361,7 @@ transact (TALER_ARL_Analysis analysis, | |||
367 | "Processing failed (or no changes), rolling back transaction\n"); | 361 | "Processing failed (or no changes), rolling back transaction\n"); |
368 | TALER_ARL_adb->rollback (TALER_ARL_adb->cls, | 362 | TALER_ARL_adb->rollback (TALER_ARL_adb->cls, |
369 | TALER_ARL_asession); | 363 | TALER_ARL_asession); |
370 | TALER_ARL_edb->rollback (TALER_ARL_edb->cls, | 364 | TALER_ARL_edb->rollback (TALER_ARL_edb->cls); |
371 | TALER_ARL_esession); | ||
372 | } | 365 | } |
373 | switch (qs) | 366 | switch (qs) |
374 | { | 367 | { |
@@ -396,11 +389,11 @@ int | |||
396 | TALER_ARL_setup_sessions_and_run (TALER_ARL_Analysis ana, | 389 | TALER_ARL_setup_sessions_and_run (TALER_ARL_Analysis ana, |
397 | void *ana_cls) | 390 | void *ana_cls) |
398 | { | 391 | { |
399 | TALER_ARL_esession = TALER_ARL_edb->get_session (TALER_ARL_edb->cls); | 392 | if (GNUNET_OK != |
400 | if (NULL == TALER_ARL_esession) | 393 | TALER_ARL_edb->preflight (TALER_ARL_edb->cls)) |
401 | { | 394 | { |
402 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 395 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
403 | "Failed to initialize exchange session.\n"); | 396 | "Failed to initialize exchange connection.\n"); |
404 | return GNUNET_SYSERR; | 397 | return GNUNET_SYSERR; |
405 | } | 398 | } |
406 | TALER_ARL_asession = TALER_ARL_adb->get_session (TALER_ARL_adb->cls); | 399 | TALER_ARL_asession = TALER_ARL_adb->get_session (TALER_ARL_adb->cls); |