Changeset 17475 for trunk/Ohana/src/opihi/pcontrol/CheckHost.c
- Timestamp:
- Apr 23, 2008, 11:35:39 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/pcontrol/CheckHost.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/pcontrol/CheckHost.c
r10652 r17475 1 1 # include "pcontrol.h" 2 2 3 // if the host has a job, we skip it (down or crash state will be caught elsewhere) 4 // in fact, just touch the IDLE hosts, not the BUSY hosts? 3 5 int CheckHost (Host *host) { 4 6 5 7 int status; 6 IOBuffer buffer;7 8 8 9 ASSERT (host, "host not set"); … … 18 19 } 19 20 20 InitIOBuffer (&buffer, 0x100); 21 // the argument to echo (OK) is the expected response below in CheckHostResponse 22 status = PclientCommand (host, "echo OK", PCLIENT_PROMPT, PCONTROL_RESP_CHECK_HOST); 21 23 22 status = PclientCommand (host, "echo OK", PCLIENT_PROMPT, &buffer);23 24 switch (status) { 24 case 0:25 case PCLIENT_DOWN: 25 26 if (VerboseMode()) gprint (GP_ERR, "host %s is down\n", host[0].hostname); 26 27 HarvestHost (host[0].pid); 27 28 PutHost (host, PCONTROL_HOST_DOWN, STACK_BOTTOM); 28 FreeIOBuffer (&buffer);29 29 return (FALSE); 30 30 31 case -1: 32 if (VerboseMode()) gprint (GP_ERR, "host %s is not responding\n", host[0].hostname); 33 /*** do we mark this in some way (HUNG) ? ***/ 34 PutHost (host, host[0].stack, STACK_BOTTOM); 35 FreeIOBuffer (&buffer); 36 return (FALSE); 31 case PCLIENT_GOOD: 32 PutHost (host, PCONTROL_HOST_RESP, STACK_BOTTOM); 33 return (TRUE); 37 34 38 35 default: 39 PutHost (host, host[0].stack, STACK_BOTTOM); 40 FreeIOBuffer (&buffer); 41 return (TRUE); 36 ABORT ("unknown status for pclient command"); 42 37 } 43 ABORT ("should not reach here (Check Host)");38 ABORT ("should not reach here (CheckHost)"); 44 39 } 45 40 46 // if the host has a job, we skip it (down or crash state will be caught elsewhere) 47 // in fact, just touch the IDLE hosts, not the BUSY hosts? 41 int CheckHostResponse (Host *host) { 42 43 IOBuffer *buffer; 44 45 /* we only check IDLE hosts without jobs */ 46 ASSERT (host, "missing host"); 47 buffer = &host[0].comms_buffer; 48 49 // XXX check on the value of the response? (OK) 50 51 PutHost (host, PCONTROL_HOST_IDLE, STACK_BOTTOM); 52 return (TRUE); 53 }
Note:
See TracChangeset
for help on using the changeset viewer.
