Changeset 17475 for trunk/Ohana/src/opihi/pcontrol/CheckDoneHost.c
- Timestamp:
- Apr 23, 2008, 11:35:39 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/pcontrol/CheckDoneHost.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/pcontrol/CheckDoneHost.c
r10668 r17475 5 5 6 6 int status; 7 char *p;8 IOBuffer buffer;9 7 10 8 ASSERT (host, "host not set"); 11 9 12 InitIOBuffer (&buffer, 0x100); 13 14 status = PclientCommand (host, "reset", PCLIENT_PROMPT, &buffer); 10 status = PclientCommand (host, "reset", PCLIENT_PROMPT, PCONTROL_RESP_CHECK_DONE_HOST); 15 11 16 12 /* check on success of pclient command */ … … 18 14 case PCLIENT_DOWN: 19 15 if (DEBUG || VerboseMode()) gprint (GP_ERR, "host %s is down\n", host[0].hostname); 20 /* DONE host does not have an incomplete job */21 16 HarvestHost (host[0].pid); 22 17 PutHost (host, PCONTROL_HOST_DOWN, STACK_BOTTOM); 23 FreeIOBuffer (&buffer);24 18 return (FALSE); 19 /* DONE host does not have an incomplete job */ 25 20 // XXX do we need to close the connection? 26 21 27 case PCLIENT_HUNG:28 // don't do anything drastic, just try again later29 PutHost (host, PCONTROL_HOST_DONE, STACK_BOTTOM);30 if (DEBUG || VerboseMode()) gprint (GP_ERR, "host %s is not responding\n", host[0].hostname);31 FreeIOBuffer (&buffer);32 return (FALSE);33 34 22 case PCLIENT_GOOD: 35 if (VerboseMode()) gprint (GP_ERR, "message received (CheckDoneHost)\n"); 36 break; 23 if (VerboseMode()) gprint (GP_ERR, "checking done host %s\n", host[0].hostname); 24 PutHost (host, PCONTROL_HOST_RESP, STACK_BOTTOM); 25 return (TRUE); 37 26 38 27 default: 39 28 ABORT ("unknown status for pclient command"); 40 29 } 30 ABORT ("should not reach here (CheckDoneHost)"); 31 } 32 33 int CheckDoneHostResponse (Host *host) { 34 35 int status; 36 char *p; 37 IOBuffer *buffer; 38 39 /* job must have assigned host */ 40 ASSERT (host, "missing host"); 41 ASSERT (host[0].job, "missing job"); 42 buffer = &host[0].comms_buffer; 41 43 42 44 /** successful command, examine result **/ 43 p = memstr (buffer .buffer, "STATUS", buffer.Nbuffer);45 p = memstr (buffer[0].buffer, "STATUS", buffer[0].Nbuffer); 44 46 ASSERT (p != NULL, "missing STATUS in pclient message (CheckDoneHost)"); 45 47 … … 52 54 if (DEBUG || VerboseMode()) gprint (GP_ERR, "reset failed\n"); 53 55 PutHost (host, PCONTROL_HOST_DONE, STACK_BOTTOM); 54 FreeIOBuffer (&buffer);55 56 return (FALSE); 56 57 … … 59 60 if (DEBUG || VerboseMode()) gprint (GP_ERR, "successful reset\n"); 60 61 PutHost (host, PCONTROL_HOST_IDLE, STACK_BOTTOM); 61 FreeIOBuffer (&buffer);62 62 return (FALSE); 63 63 … … 67 67 ABORT ("should not reach here (CheckDoneHost)"); 68 68 } 69 70 /** probably need to flush the buffer before the command **/71 /** need to add timeout check here **/
Note:
See TracChangeset
for help on using the changeset viewer.
