glom r2045 - in trunk: . glom/libglom/connectionpool_backends



Author: arminb
Date: Thu Apr  2 11:09:36 2009
New Revision: 2045
URL: http://svn.gnome.org/viewvc/glom?rev=2045&view=rev

Log:
2009-04-02  Armin Burgmeier  <armin openismus com>

	* glom/libglom/connectionpool_backends/postgres_self.cc
	(discover_first_free_port): Fixed the logic in this function to allow
	two different glom instances to self-host a database at the same time.


Modified:
   trunk/ChangeLog
   trunk/glom/libglom/connectionpool_backends/postgres_self.cc

Modified: trunk/glom/libglom/connectionpool_backends/postgres_self.cc
==============================================================================
--- trunk/glom/libglom/connectionpool_backends/postgres_self.cc	(original)
+++ trunk/glom/libglom/connectionpool_backends/postgres_self.cc	Thu Apr  2 11:09:36 2009
@@ -458,24 +458,24 @@
       #ifdef EPORTINUSE //Linux doesn't have this.
       available = (errno != EPORTINUSE);
       #endif
-
-      if(available)
-      {
-        #ifdef G_OS_WIN32
-        closesocket(fd);
-        #else
-        close(fd);
-        #endif //G_OS_WIN32
-
-        //std::cout << "debug: ConnectionPool::discover_first_free_port(): Found: returning " << port_to_try << std::endl;
-        return port_to_try;
-      }
     }
     else
     {
       //std::cout << "debug: ConnectionPool::discover_first_free_port(): port in use: " << port_to_try << std::endl;
     }
 
+    if(available)
+    {
+      #ifdef G_OS_WIN32
+      closesocket(fd);
+      #else
+      close(fd);
+      #endif //G_OS_WIN32
+
+      //std::cout << "debug: ConnectionPool::discover_first_free_port(): Found: returning " << port_to_try << std::endl;
+      return port_to_try;
+    }
+
     ++port_to_try;
   }
 



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