glom r2046 - in branches/glom-1-10: . glom/libglom/connectionpool_backends



Author: murrayc
Date: Thu Apr  2 16:11:54 2009
New Revision: 2046
URL: http://svn.gnome.org/viewvc/glom?rev=2046&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:
   branches/glom-1-10/ChangeLog
   branches/glom-1-10/glom/libglom/connectionpool_backends/postgres_self.cc

Modified: branches/glom-1-10/glom/libglom/connectionpool_backends/postgres_self.cc
==============================================================================
--- branches/glom-1-10/glom/libglom/connectionpool_backends/postgres_self.cc	(original)
+++ branches/glom-1-10/glom/libglom/connectionpool_backends/postgres_self.cc	Thu Apr  2 16:11:54 2009
@@ -521,24 +521,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]