Optimize clone procedure
[anna.git] / example / diameter / launcher / Launcher.cpp
index 8ea7511..45f51a9 100644 (file)
@@ -802,7 +802,7 @@ void Launcher::resetCounters() throw() {
 
 void Launcher::signalUSR2() throw(anna::RuntimeException) {
   LOGNOTICE(
-      std::string msg = "Captured signal SIGUSR2. Reading tasks at '";
+  std::string msg = "Captured signal SIGUSR2. Reading tasks at '";
   msg += SIGUSR2_TASKS_INPUT_FILENAME;
   msg += "' (results will be written at '";
   msg += SIGUSR2_TASKS_OUTPUT_FILENAME;
@@ -817,7 +817,6 @@ void Launcher::signalUSR2() throw(anna::RuntimeException) {
   std::ofstream out_file(SIGUSR2_TASKS_OUTPUT_FILENAME);
 
   if(!in_file.is_open()) throw RuntimeException("Unable to read tasks", ANNA_FILE_LOCATION);
-
   if(!out_file.is_open()) throw RuntimeException("Unable to write tasks", ANNA_FILE_LOCATION);
 
   while(getline(in_file, line)) {
@@ -837,6 +836,7 @@ void Launcher::signalUSR2() throw(anna::RuntimeException) {
   }
 
   in_file.close();
+  out_file << "EOF\n";
   out_file.close();
 }
 
@@ -1163,6 +1163,7 @@ std::string Launcher::help() const throw() {
   result += "\n";
   result += "\n                              delay|<msecs>              Blocking step until the time lapse expires. Useful to give ";
   result += "\n                                                          some cadence control and time schedule for a specific case.";
+  result += "\n                                                         A value of 0 could be used as a dummy step.";
   result += "\n                              wait<fe/fc>|<condition>    Blocking step until condition is fulfilled. The message could";
   result += "\n                                                          received from entity (waitfe) or from client (waitfc).";
   result += "\n";
@@ -1402,6 +1403,8 @@ std::string Launcher::help() const throw() {
   result += "\n    and then see the results:";
   result += "\n   cat "; result += SIGUSR2_TASKS_OUTPUT_FILENAME;
   result += "\n";
+  result += "\n   (this file is ended with EOF final line, useful managing huge batch files to ensure the job completion)";
+  result += "\n";
   result += "\nYou could place more than one line (task) in the input file. Output reports will be appended in that";
   result += "\n case over the output file. Take into account that all the content of the task file will be executed";
   result += "\n sinchronously by the process. If you are planning traffic load, better use the asynchronous http";
@@ -2016,7 +2019,7 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons
         if (numParams > 3)
           throw anna::RuntimeException("Wrong body content format on HTTP Request. Use 'help' management command to see more information.", ANNA_FILE_LOCATION);
         if(param3 == "") throw anna::RuntimeException("Missing milliseconds for 'delay' command in test id operation", ANNA_FILE_LOCATION);
-        anna::Millisecond delay = checkTimeMeasure("Test case delay step", param3);
+        anna::Millisecond delay = ((param3 == "0" /* special case */) ? (anna::Millisecond)0 : checkTimeMeasure("Test case delay step", param3));
         testManager.getTestCase(id)->addDelay(delay); // creates / reuses
       }
       else if ((param2 == "waitfe")||(param2 == "waitfc")) {