glom r1451 - in trunk: . glom glom/libglom



Author: arminb
Date: Sun Mar  9 15:30:14 2008
New Revision: 1451
URL: http://svn.gnome.org/viewvc/glom?rev=1451&view=rev

Log:
2008-03-09  Armin Burgmeier  <armin openismus com>

	* glom/libglom/connectionpool.cc: Don't try to use remembered port
	when m_port is 0. This broke connections to non-self-hosted database
	servers since the connection attempt was only performed on port 0.

	* glom/application.cc: Set "try_other_ports" to TRUE for new documents
	if the document is not self-hosted. Otherwise, only port 5432 was
	tried, and not the other ones specefied in the ConnectionPool's
	constructor.


Modified:
   trunk/ChangeLog
   trunk/glom/application.cc
   trunk/glom/libglom/connectionpool.cc

Modified: trunk/glom/application.cc
==============================================================================
--- trunk/glom/application.cc	(original)
+++ trunk/glom/application.cc	Sun Mar  9 15:30:14 2008
@@ -920,6 +920,7 @@
 #endif
 
         int port_used = 0;
+	bool try_other_ports = true;
 
         //Set the connection details in the ConnectionPool singleton.
         //The ConnectionPool will now use these every time it tries to connect.
@@ -937,20 +938,20 @@
 
             port_used = connection_pool->get_port();
           }
+
+          //Make sure that we open the just-started self-hosted postgres server instead of any other postgres running on the same host.
+	  try_other_ports = false;
         }
         else
         {
-          connection_pool->set_self_hosted(std::string());
         }
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 
         connection_pool->set_host(pDocument->get_connection_server());
         connection_pool->set_user(pDocument->get_connection_user());
         connection_pool->set_database(pDocument->get_connection_database());
-
-        //Make sure that we open the just-started self-hosted postgres server instead of any other postgres running on the same host.
         connection_pool->set_port(port_used);
-        connection_pool->set_try_other_ports(false);
+        connection_pool->set_try_other_ports(try_other_ports);
 
         connection_pool->set_ready_to_connect(this); //Box_DB::connect_to_server() will now attempt the connection-> Shared instances of m_Connection will also be usable.
 
@@ -1268,6 +1269,9 @@
 
       //Make sure that the user can do something with his new document:
       document->set_userlevel(AppState::USERLEVEL_DEVELOPER);
+      // Try various ports if connecting to an existing database server instead
+      // of self-hosting one:
+      document->set_connection_try_other_ports(!m_ui_save_extra_newdb_selfhosted);
 
       //Each new document must have an associated new database,
       //so ask the user for the name of one to create:

Modified: trunk/glom/libglom/connectionpool.cc
==============================================================================
--- trunk/glom/libglom/connectionpool.cc	(original)
+++ trunk/glom/libglom/connectionpool.cc	Sun Mar  9 15:30:14 2008
@@ -64,7 +64,7 @@
 #endif
 
 // Uncomment to see debug messages
-//#define AVAHI_DEBUG
+#define AVAHI_DEBUG
 
 namespace
 {
@@ -319,7 +319,7 @@
 
         //If no port is known to work, start with the first possible port:
         bool trying_remembered_port = true;
-        if(port.empty())
+        if(port.empty() || m_port == 0)
         {
           port = *iter_port;
           trying_remembered_port = false;



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