[glom/glom-1-30] Postgres::attempt_connect(): Specify a timeout.



commit 51612047c61bf26d483f5ce123349f9004bff8d4
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Dec 15 09:04:22 2015 +0100

    Postgres::attempt_connect(): Specify a timeout.
    
    Via the CONNECT_TIMEOUT paramater for libgda's cnc_string,
    as listed by this command-line command:
      gda-sql-5.0 -L PostgreSQL

 glom/libglom/connectionpool_backends/postgres.cc |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/glom/libglom/connectionpool_backends/postgres.cc 
b/glom/libglom/connectionpool_backends/postgres.cc
index 8fb7f18..ca550a6 100644
--- a/glom/libglom/connectionpool_backends/postgres.cc
+++ b/glom/libglom/connectionpool_backends/postgres.cc
@@ -73,7 +73,8 @@ Glib::RefPtr<Gnome::Gda::Connection> Postgres::attempt_connect(const Glib::ustri
   const auto default_database = "template1";
   //const auto actual_database = (!database.empty()) ? database : default_database;;
   const auto cnc_string_main = "HOST=" + DbUtils::gda_cnc_string_encode(m_host)
-   + ";PORT=" + DbUtils::gda_cnc_string_encode(port);
+   + ";PORT=" + DbUtils::gda_cnc_string_encode(port)
+   + ";CONNECT_TIMEOUT=10"; //10 seconds timeout, instead of indefinite.
   const auto cnc_string = cnc_string_main + ";DB_NAME=" + DbUtils::gda_cnc_string_encode(database);
 
   Glib::RefPtr<Gnome::Gda::Connection> connection;


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