From 118c2bb48f2ebc13734df9d208c285934622a475 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 30 Jul 2021 13:49:12 +0200 Subject: -fix misc enum confusions --- src/include/sync_database_plugin.h | 2 +- src/lib/sync_api_download.c | 2 +- src/syncdb/plugin_syncdb_postgres.c | 28 +++++++++++++++++++--------- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/include/sync_database_plugin.h b/src/include/sync_database_plugin.h index 421f157..f14e007 100644 --- a/src/include/sync_database_plugin.h +++ b/src/include/sync_database_plugin.h @@ -132,7 +132,7 @@ struct SYNC_DatabasePlugin * this value should be garbage collected * @return transaction status */ - enum SYNC_DB_QueryStatus + enum GNUNET_DB_QueryStatus (*gc)(void *cls, struct GNUNET_TIME_Absolute expire, struct GNUNET_TIME_Absolute expire_pending_payments); diff --git a/src/lib/sync_api_download.c b/src/lib/sync_api_download.c index e7e90cd..9a7c8f5 100644 --- a/src/lib/sync_api_download.c +++ b/src/lib/sync_api_download.c @@ -294,7 +294,7 @@ SYNC_download (struct GNUNET_CURL_Context *ctx, download->cb_cls = cb_cls; download->job = GNUNET_CURL_job_add_raw (ctx, eh, - GNUNET_NO, + NULL, &handle_download_finished, download); return download; diff --git a/src/syncdb/plugin_syncdb_postgres.c b/src/syncdb/plugin_syncdb_postgres.c index 2538070..c432dde 100644 --- a/src/syncdb/plugin_syncdb_postgres.c +++ b/src/syncdb/plugin_syncdb_postgres.c @@ -196,7 +196,7 @@ static enum GNUNET_DB_QueryStatus commit_transaction (void *cls) { struct PostgresClosure *pg = cls; - enum SYNC_DB_QueryStatus qs; + enum GNUNET_DB_QueryStatus qs; struct GNUNET_PQ_QueryParam no_params[] = { GNUNET_PQ_query_param_end }; @@ -222,7 +222,7 @@ commit_transaction (void *cls) * this value should be garbage collected * @return transaction status */ -static enum SYNC_DB_QueryStatus +static enum GNUNET_DB_QueryStatus postgres_gc (void *cls, struct GNUNET_TIME_Absolute expire_backups, struct GNUNET_TIME_Absolute expire_pending_payments) @@ -236,7 +236,7 @@ postgres_gc (void *cls, TALER_PQ_query_param_absolute_time (&expire_pending_payments), GNUNET_PQ_query_param_end }; - enum SYNC_DB_QueryStatus qs; + enum GNUNET_DB_QueryStatus qs; check_connection (pg); postgres_preflight (pg); @@ -574,7 +574,7 @@ postgres_store_backup (void *cls, /* previous conflicting backup exists */ return SYNC_DB_OLD_BACKUP_MISMATCH; /* backup identical to what was provided, no change */ - return GNUNET_DB_STATUS_SUCCESS_NO_RESULTS; + return SYNC_DB_NO_RESULTS; } @@ -719,7 +719,7 @@ postgres_update_backup (void *cls, old_backup_hash)) /* all constraints seem satisfied, original error must have been a hard error */ - return GNUNET_DB_STATUS_HARD_ERROR; + return SYNC_DB_HARD_ERROR; /* previous backup does not match old_backup_hash */ return SYNC_DB_OLD_BACKUP_MISMATCH; } @@ -897,7 +897,7 @@ postgres_increment_lifetime (void *cls, "increment lifetime")) { GNUNET_break (0); - return GNUNET_DB_STATUS_HARD_ERROR; + return SYNC_DB_HARD_ERROR; } { @@ -910,11 +910,21 @@ postgres_increment_lifetime (void *cls, qs = GNUNET_PQ_eval_prepared_non_select (pg->conn, "payment_done", params); - if (0 >= qs) + switch (qs) { - /* payment made before, or unknown, or error => no further action! */ + case GNUNET_DB_STATUS_HARD_ERROR: + GNUNET_break (0); + rollback (pg); + return SYNC_DB_HARD_ERROR; + case GNUNET_DB_STATUS_SOFT_ERROR: + GNUNET_break (0); + rollback (pg); + return SYNC_DB_SOFT_ERROR; + case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: rollback (pg); - return qs; + return SYNC_DB_NO_RESULTS; + case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: + break; } } -- cgit v1.2.3