2012-02-07 Ramon Novoa <rnovoa@artica.es>

* win32/pandora_windows_service.cc: Added a timeout to the tentacle
	  client execution.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5507 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
ramonn 2012-02-07 16:33:01 +00:00
parent c43cafdf67
commit 928f8c4bf9
2 changed files with 19 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2012-02-07 Ramon Novoa <rnovoa@artica.es>
* win32/pandora_windows_service.cc: Added a timeout to the tentacle
client execution.
2011-12-13 Ramon Novoa <rnovoa@artica.es>
* win32/installer/pandora.mpi,

View File

@ -447,6 +447,7 @@ Pandora_Windows_Service::copyTentacleDataFile (string host,
string tentacle_cmd, working_dir;
PROCESS_INFORMATION pi;
STARTUPINFO si;
int tentacle_timeout = 0;
var = conf->getValue ("temporal");
if (var[var.length () - 1] != '\\') {
@ -488,8 +489,19 @@ Pandora_Windows_Service::copyTentacleDataFile (string host,
return -1;
}
/* Timeout */
tentacle_timeout = atoi (conf->getValue ("tentacle_timeout").c_str ());
if (tentacle_timeout <= 0) {
tentacle_timeout = INFINITE;
}
if (WaitForSingleObject(pi.hProcess, tentacle_timeout) == WAIT_TIMEOUT) {
TerminateProcess(pi.hThread, STILL_ACTIVE);
CloseHandle (pi.hProcess);
return -1;
}
/* Get the return code of the tentacle client*/
WaitForSingleObject(pi.hProcess, INFINITE);
GetExitCodeProcess (pi.hProcess, &rc);
if (rc != 0) {
CloseHandle (pi.hProcess);