gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] 02/02: add GNUNET_PQ_reconnect_if_down


From: gnunet
Subject: [GNUnet-SVN] [gnunet] 02/02: add GNUNET_PQ_reconnect_if_down
Date: Fri, 11 Oct 2019 23:38:28 +0200

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

grothoff pushed a commit to branch master
in repository gnunet.

commit 195fd08b9f0f46efd63dd87fb8f5fdbaca8ca610
Author: Christian Grothoff <address@hidden>
AuthorDate: Fri Oct 11 23:20:13 2019 +0200

    add GNUNET_PQ_reconnect_if_down
---
 src/include/gnunet_pq_lib.h |  9 +++++++++
 src/pq/pq_connect.c         | 14 ++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/src/include/gnunet_pq_lib.h b/src/include/gnunet_pq_lib.h
index a56df21fd..2aea77b7f 100644
--- a/src/include/gnunet_pq_lib.h
+++ b/src/include/gnunet_pq_lib.h
@@ -748,6 +748,15 @@ GNUNET_PQ_connect_with_cfg (const struct 
GNUNET_CONFIGURATION_Handle *cfg,
                             const struct GNUNET_PQ_PreparedStatement *ps);
 
 
+/**
+ * Reinitialize the database @a db if the connection is down.
+ *
+ * @param db database connection to reinitialize
+ */
+void
+GNUNET_PQ_reconnect_if_down (struct GNUNET_PQ_Context *db);
+
+
 /**
  * Reinitialize the database @a db.
  *
diff --git a/src/pq/pq_connect.c b/src/pq/pq_connect.c
index 7599f4b15..882df4f89 100644
--- a/src/pq/pq_connect.c
+++ b/src/pq/pq_connect.c
@@ -127,6 +127,20 @@ GNUNET_PQ_connect (const char *config_str,
 }
 
 
+/**
+ * Reinitialize the database @a db if the connection is down.
+ *
+ * @param db database connection to reinitialize
+ */
+void
+GNUNET_PQ_reconnect_if_down (struct GNUNET_PQ_Context *db)
+{
+  if (CONNECTION_BAD != PQstatus (db->conn))
+    return;
+  GNUNET_PQ_reconnect (db);
+}
+
+
 /**
  * Reinitialize the database @a db.
  *

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

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