Date: Tuesday, January 9, 2007 @ 20:55:38
  Author: marc
    Path: /cvsroot/carob/carob/src

Modified: ConnectionParameters.cpp (1.27 -> 1.28) ControllerWatcher.cpp
          (1.9 -> 1.10)

Implemented "stillborn_hack" secret controller_timeout value that disables both 
pinger and watcher threads.


--------------------------+
 ConnectionParameters.cpp |    3 ++-
 ControllerWatcher.cpp    |   23 +++++++++++++++++++++++
 2 files changed, 25 insertions(+), 1 deletion(-)


Index: carob/src/ConnectionParameters.cpp
diff -u carob/src/ConnectionParameters.cpp:1.27 
carob/src/ConnectionParameters.cpp:1.28
--- carob/src/ConnectionParameters.cpp:1.27     Tue Dec  5 12:06:10 2006
+++ carob/src/ConnectionParameters.cpp  Tue Jan  9 20:55:38 2007
@@ -66,7 +66,8 @@
   // Put default values if given delay/timeout are unrelevant
   if (ping_delay_in_ms <= 0)
     ping_delay_in_ms = DEFAULT_PING_DELAY;
-  if (controller_timeout_in_ms <= 0)
+  // -3210 = disable pingers, see stillborn_hack in ControllerWatcher.cpp
+  if (controller_timeout_in_ms <= 0 && controller_timeout_in_ms != -3210)
     controller_timeout_in_ms = DEFAULT_CONTROLLER_TIMEOUT;
 }
 
Index: carob/src/ControllerWatcher.cpp
diff -u carob/src/ControllerWatcher.cpp:1.9 carob/src/ControllerWatcher.cpp:1.10
--- carob/src/ControllerWatcher.cpp:1.9 Thu Dec 21 23:23:17 2006
+++ carob/src/ControllerWatcher.cpp     Tue Jan  9 20:55:38 2007
@@ -38,6 +38,10 @@
 using std::vector;
 using std::wstring;
 
+namespace {
+  const int stillborn_hack(-3210);
+}
+
 // extern C thread function that launches the ping
 void* ControllerWatcherThread(void * thisPtr)
 {
@@ -105,6 +109,16 @@
 #endif
 
   pinger_ptr = new ControllerPingSender(*controllers_ptr, socket_fd, 
ping_delay_in_ms);
+
+  if (controller_timeout == stillborn_hack)
+  {
+    pinger_ptr->stop();
+    std::wostringstream ostr;
+    ostr << L"ControllerPinger of Watcher " << this << L", to: "<< 
controllerList
+        << L" stillborn by " << stillborn_hack;
+    logWarn(fctName, ostr.str());
+  }
+
   pthread_create(&pinger_thread, NULL, PingSenderThread, pinger_ptr);
 }
 
@@ -157,6 +171,15 @@
   {
     logDebug(fctName, L"Watcher started");
   }
+
+  // secret code to disable the ping
+  if (controller_timeout == stillborn_hack)
+  {
+    this->stop();
+    std::wostringstream ostr; ostr << L"ControllerWatcher " << this << L" 
disabled by " << stillborn_hack;
+    logWarn(fctName, ostr.str());
+  }
+
   while (!is_stopped)
   {
     // return of poll/select function

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

Reply via email to