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:
parent
c43cafdf67
commit
928f8c4bf9
|
@ -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,
|
||||
|
|
|
@ -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] != '\\') {
|
||||
|
@ -487,9 +488,20 @@ Pandora_Windows_Service::copyTentacleDataFile (string host,
|
|||
CREATE_NO_WINDOW, NULL, NULL, &si, &pi) == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Timeout */
|
||||
tentacle_timeout = atoi (conf->getValue ("tentacle_timeout").c_str ());
|
||||
if (tentacle_timeout <= 0) {
|
||||
tentacle_timeout = INFINITE;
|
||||
}
|
||||
|
||||
/* Get the return code of the tentacle client*/
|
||||
WaitForSingleObject(pi.hProcess, 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*/
|
||||
GetExitCodeProcess (pi.hProcess, &rc);
|
||||
if (rc != 0) {
|
||||
CloseHandle (pi.hProcess);
|
||||
|
|
Loading…
Reference in New Issue