IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 23, 2008, 11:35:39 AM (18 years ago)
Author:
eugene
Message:

split out client command from client response; allow response to return slowly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/pcontrol/CheckHost.c

    r10652 r17475  
    11# include "pcontrol.h"
    22
     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?
    35int CheckHost (Host *host) {
    46 
    57  int status;
    6   IOBuffer buffer;
    78
    89  ASSERT (host, "host not set");
     
    1819  }
    1920
    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);
    2123
    22   status = PclientCommand (host, "echo OK", PCLIENT_PROMPT, &buffer);
    2324  switch (status) {
    24     case 0:
     25    case PCLIENT_DOWN:
    2526      if (VerboseMode()) gprint (GP_ERR, "host %s is down\n", host[0].hostname);
    2627      HarvestHost (host[0].pid);
    2728      PutHost (host, PCONTROL_HOST_DOWN, STACK_BOTTOM);
    28       FreeIOBuffer (&buffer);
    2929      return (FALSE);
    3030     
    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);
    3734
    3835    default:
    39       PutHost (host, host[0].stack, STACK_BOTTOM);
    40       FreeIOBuffer (&buffer);
    41       return (TRUE);
     36      ABORT ("unknown status for pclient command"); 
    4237  }
    43   ABORT ("should not reach here (Check Host)");
     38  ABORT ("should not reach here (CheckHost)");
    4439}
    4540
    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?
     41int 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.