Date: Friday, October 6, 2006 @ 17:33:36
  Author: gilles
    Path: /cvsroot/carob/carob/src

Modified: JavaSocket.cpp (1.51 -> 1.52)

Quick and dirty temporary fix to set socket read and write timeouts. Hardcoded 
for now. Should appear in connection parameters in the near future


----------------+
 JavaSocket.cpp |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+)


Index: carob/src/JavaSocket.cpp
diff -u carob/src/JavaSocket.cpp:1.51 carob/src/JavaSocket.cpp:1.52
--- carob/src/JavaSocket.cpp:1.51       Wed Sep 20 17:09:29 2006
+++ carob/src/JavaSocket.cpp    Fri Oct  6 17:33:36 2006
@@ -111,6 +111,33 @@
     throw ConnectionException(L"Set option failed on socket");
     return false;
   }
+
+  // Set receive timeout in order to failover asap when network is down
+  struct timeval timeout;
+  // FIXME: This ugly hard-coded timeout is temporary !!! Will appear in
+  // connection parameters
+  timeout.tv_sec  = 4;
+  timeout.tv_usec = 0;
+  if (setsockopt(socketFd, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout)) 
< 0)
+  {
+    if (isErrorEnabled())
+      logError(fctName, L"Could not set socket recv timeout ! failover can 
thus be very slow !");
+  }
+  else
+  {
+    if (isDebugEnabled())
+      logDebug(fctName, L"Recv timeout set.");
+  }
+  if (setsockopt(socketFd, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(timeout)) 
< 0)
+  {
+    if (isErrorEnabled())
+      logError(fctName, L"Could not set socket snd timeout ! failover can thus 
be very slow !");
+  }
+  else
+  {
+    if (isDebugEnabled())
+      logDebug(fctName, L"Snd timeout set.");
+  }
   if (isDebugEnabled())
     logDebug(fctName, L"Socket created.");
   return true;

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

Reply via email to