Changeset 20047 for trunk/Ohana/src/opihi/pcontrol/CheckDoneJob.c
- Timestamp:
- Oct 10, 2008, 12:51:04 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/pcontrol/CheckDoneJob.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/pcontrol/CheckDoneJob.c
r12840 r20047 1 1 # include "pcontrol.h" 2 # define DEBUG 0 2 3 3 4 int CheckDoneJob (Job *job, Host *host) { 4 5 5 int s uccess;6 int status1, status2; 6 7 7 8 ASSERT (job, "job not set"); … … 11 12 ASSERT (job == (Job *) host[0].job, "invalid job"); 12 13 13 success = TRUE; 14 success &= GetJobOutput ("stdout", host, &job[0].stdout_buff, job[0].stdout_size); 15 success &= GetJobOutput ("stderr", host, &job[0].stderr_buff, job[0].stderr_size); 14 status1 = GetJobOutput ("stdout", host, &job[0].stdout); 15 status2 = GetJobOutput ("stderr", host, &job[0].stderr); 16 16 17 if (!success) { 18 // XXX some kind of error? 19 // XXX try again later? 17 if ((status1 == PCLIENT_DOWN) || (status2 == PCLIENT_DOWN)) { 18 // unlink host & job 19 if (DEBUG || VerboseMode()) gprint (GP_ERR, "host %s is down\n", host[0].hostname); 20 job[0].host = NULL; 21 host[0].job = NULL; 22 23 PutJob (job, PCONTROL_JOB_PENDING, STACK_BOTTOM); 24 25 // clear the response data 26 host[0].response_state = PCONTROL_RESP_NONE; 27 host[0].response = NULL; 28 29 // host has shutdown; harvest the defunct process 30 HarvestHost (host[0].pid); 31 PutHost (host, PCONTROL_HOST_DOWN, STACK_BOTTOM); 32 return (FALSE); 33 } 34 35 // try again if we are still waiting 36 if ((status1 == PCLIENT_HUNG) || (status2 == PCLIENT_HUNG)) { 20 37 PutHost (host, PCONTROL_HOST_BUSY, STACK_BOTTOM); 21 38 PutJob (job, PCONTROL_JOB_DONE, STACK_BOTTOM); … … 32 49 return (TRUE); 33 50 } 34 35 /** need to add timeout check here **/
Note:
See TracChangeset
for help on using the changeset viewer.
