Date: Friday, March 3, 2006 @ 16:23:32
  Author: gilles
    Path: /cvsroot/carob/carob/src

Modified: Connection.cpp (1.71 -> 1.72)

Introduced CONNECT_RETRIES constant to try to connect to a controller only a 
definite number of times (was "infinitly till error")
Additionnal task of CAROB-71


----------------+
 Connection.cpp |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)


Index: carob/src/Connection.cpp
diff -u carob/src/Connection.cpp:1.71 carob/src/Connection.cpp:1.72
--- carob/src/Connection.cpp:1.71       Fri Mar  3 16:18:47 2006
+++ carob/src/Connection.cpp    Fri Mar  3 16:23:32 2006
@@ -37,6 +37,7 @@
 using namespace CarobNS;
 
 #define RECONNECT_RETRIES 10
+#define CONNECT_RETRIES 3
 
 // The reconnection macro:
 // When a SocketIOException occurs between these to macros, sleep and try to
@@ -82,7 +83,7 @@
       throw DriverException(L"Unsupported connection policy #" + 
toWString(parameters.getConnectPolicy()));
   }
   persistent_connection = parameters.getPersistentConnection();
-  while (isClosed)
+  for (int connectRetry = 0; connectRetry<CONNECT_RETRIES; connectRetry++)
   {
     try
     {
@@ -94,6 +95,7 @@
       if (initConnection() && finalizeConnect())
       {
         isClosed = false;
+        return;
       }
     }
     // SocketIO and connection exceptions indicate dead controller => try to

_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits

Reply via email to