gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated: stasis: fix some DB issues


From: gnunet
Subject: [taler-anastasis] branch master updated: stasis: fix some DB issues
Date: Mon, 01 Nov 2021 16:44:28 +0100

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

dold pushed a commit to branch master
in repository anastasis.

The following commit(s) were added to refs/heads/master by this push:
     new 3cd50b4  stasis: fix some DB issues
3cd50b4 is described below

commit 3cd50b42f77908fb0e428dcfdbfd617731dcc3ae
Author: Florian Dold <florian@dold.me>
AuthorDate: Mon Nov 1 16:43:49 2021 +0100

    stasis: fix some DB issues
    
    * do not always create a new DB connection
    * use the correct config section
---
 src/stasis/plugin_anastasis_postgres.c | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/src/stasis/plugin_anastasis_postgres.c 
b/src/stasis/plugin_anastasis_postgres.c
index b0b8f96..729c76d 100644
--- a/src/stasis/plugin_anastasis_postgres.c
+++ b/src/stasis/plugin_anastasis_postgres.c
@@ -134,7 +134,7 @@ postgres_create_tables (void *cls)
  * @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure
  */
 static enum GNUNET_GenericReturnValue
-postgres_connect (void *cls)
+prepare_statements (void *cls)
 {
   struct PostgresClosure *pg = cls;
   struct GNUNET_PQ_PreparedStatement ps[] = {
@@ -502,14 +502,16 @@ postgres_connect (void *cls)
     GNUNET_PQ_PREPARED_STATEMENT_END
   };
 
-  pg->conn = GNUNET_PQ_connect_with_cfg (pg->cfg,
-                                         "stasis-postgres",
-                                         NULL,
-                                         NULL,
-                                         ps);
-  if (NULL == pg->conn)
-    return GNUNET_SYSERR;
-  return GNUNET_OK;
+  {
+    enum GNUNET_GenericReturnValue ret;
+
+    ret = GNUNET_PQ_prepare_statements (pg->conn,
+                                        ps);
+    if (GNUNET_OK != ret)
+      return ret;
+    pg->init = true;
+    return GNUNET_OK;
+  }
 }
 
 
@@ -562,7 +564,7 @@ internal_setup (struct PostgresClosure *pg,
     struct GNUNET_PQ_Context *db_conn;
 
     db_conn = GNUNET_PQ_connect_with_cfg (pg->cfg,
-                                          "exchangedb-postgres",
+                                          "stasis-postgres",
                                           NULL,
                                           es,
                                           NULL);
@@ -576,7 +578,7 @@ internal_setup (struct PostgresClosure *pg,
     return GNUNET_OK;
   if (skip_prepare)
     return GNUNET_OK;
-  return postgres_connect (pg);
+  return prepare_statements (pg);
 }
 
 
@@ -2784,7 +2786,8 @@ libanastasis_plugin_db_postgres_init (void *cls)
   }
   plugin = GNUNET_new (struct ANASTASIS_DatabasePlugin);
   plugin->cls = pg;
-  plugin->connect = &postgres_connect;
+  /* FIXME: Should this be the same? */
+  plugin->connect = &postgres_preflight;
   plugin->create_tables = &postgres_create_tables;
   plugin->drop_tables = &postgres_drop_tables;
   plugin->gc = &postgres_gc;

-- 
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]