gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-exchange] branch master updated: -fix crash in wirewatch if badly


From: gnunet
Subject: [taler-exchange] branch master updated: -fix crash in wirewatch if badly configured
Date: Fri, 06 Jan 2023 15:26:13 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new ade221f9 -fix crash in wirewatch if badly configured
ade221f9 is described below

commit ade221f9741aba5c8b3efdf022fd95b9f363b1d8
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Fri Jan 6 15:26:10 2023 +0100

    -fix crash in wirewatch if badly configured
---
 src/exchange/taler-exchange-wirewatch.c | 26 +++++++++++++++-----------
 src/exchangedb/pg_abort_shard.c         | 13 ++++++-------
 2 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/src/exchange/taler-exchange-wirewatch.c 
b/src/exchange/taler-exchange-wirewatch.c
index ff7b93b5..337b11ca 100644
--- a/src/exchange/taler-exchange-wirewatch.c
+++ b/src/exchange/taler-exchange-wirewatch.c
@@ -225,13 +225,16 @@ shutdown_task (void *cls)
     db_plugin->rollback (db_plugin->cls);
     started_transaction = false;
   }
-  qs = db_plugin->abort_shard (db_plugin->cls,
-                               job_name,
-                               shard_start,
-                               shard_end);
-  if (qs <= 0)
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Failed to abort work shard on shutdown\n");
+  if (shard_open)
+  {
+    qs = db_plugin->abort_shard (db_plugin->cls,
+                                 job_name,
+                                 shard_start,
+                                 shard_end);
+    if (qs <= 0)
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                  "Failed to abort work shard on shutdown\n");
+  }
   GNUNET_free (job_name);
   if (NULL != ctx)
   {
@@ -327,8 +330,6 @@ exchange_serve_process_config (void)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "No wire accounts configured for credit!\n");
-    TALER_EXCHANGEDB_plugin_unload (db_plugin);
-    db_plugin = NULL;
     return GNUNET_SYSERR;
   }
   TALER_EXCHANGEDB_find_accounts (&add_account_cb,
@@ -339,8 +340,6 @@ exchange_serve_process_config (void)
                 "No accounts enabled for credit!\n");
     GNUNET_SCHEDULER_shutdown ();
     global_ret = EXIT_INVALIDARGUMENT;
-    TALER_EXCHANGEDB_plugin_unload (db_plugin);
-    db_plugin = NULL;
     return GNUNET_SYSERR;
   }
   return GNUNET_OK;
@@ -1142,6 +1141,11 @@ continue_with_shard (void *cls)
 }
 
 
+/**
+ * Reserve a shard for us to work on.
+ *
+ * @param cls NULL
+ */
 static void
 lock_shard (void *cls)
 {
diff --git a/src/exchangedb/pg_abort_shard.c b/src/exchangedb/pg_abort_shard.c
index de10f7d3..d04680a8 100644
--- a/src/exchangedb/pg_abort_shard.c
+++ b/src/exchangedb/pg_abort_shard.c
@@ -28,9 +28,9 @@
 
 enum GNUNET_DB_QueryStatus
 TEH_PG_abort_shard (void *cls,
-                      const char *job_name,
-                      uint64_t start_row,
-                      uint64_t end_row)
+                    const char *job_name,
+                    uint64_t start_row,
+                    uint64_t end_row)
 {
   struct PostgresClosure *pg = cls;
   struct GNUNET_PQ_QueryParam params[] = {
@@ -40,14 +40,13 @@ TEH_PG_abort_shard (void *cls,
     GNUNET_PQ_query_param_end
   };
 
-
   PREPARE (pg,
            "abort_shard",
            "UPDATE work_shards"
            "   SET last_attempt=0"
-           " WHERE job_name = $1 "
-           "    AND start_row = $2 "
-           "    AND end_row = $3;");
+           " WHERE job_name=$1"
+           "   AND start_row=$2"
+           "   AND end_row=$3;");
   return GNUNET_PQ_eval_prepared_non_select (pg->conn,
                                              "abort_shard",
                                              params);

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]