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/ResetJob.c

    r16472 r17475  
    11# include "pcontrol.h"
     2
     3// XXX deprecated
    24
    35int ResetJob (Job *job) {
    46 
    57  int       status;
    6   IOBuffer  buffer;
    78  Host     *host;
    89
     
    1314  ASSERT (job != NULL, "host missing");
    1415
    15   InitIOBuffer (&buffer, 0x100);
    16  
    1716  /* we have tried to reset the job; may not get status */
    1817  job[0].Reset = TRUE;
    1918
    20   status = PclientCommand (host, "reset", PCLIENT_PROMPT, &buffer);
     19  status = PclientCommand (host, "reset");
    2120
    2221  /* check on success of pclient command */
    2322  switch (status) {
    2423    case PCLIENT_DOWN:
    25       /*** different behavior for ANYHOST, WANTHOST, NEEDHOST? ***/
    26       gprint (GP_ERR, "host %s is down\n", host[0].hostname);
     24      if (VerboseMode()) gprint (GP_ERR, "host %s is down\n", host[0].hostname);
    2725      HarvestHost (host[0].pid);
    2826      PutHost (host, PCONTROL_HOST_DOWN, STACK_BOTTOM);
    29       FreeIOBuffer (&buffer);
    30       return (FALSE);
    31 
    32     case PCLIENT_HUNG:
    33       /*** should we consider a HUNG host DOWN? ***/
    34       gprint (GP_ERR, "host %s is not responding (ResetJob)\n", host[0].hostname);
    35       FreeIOBuffer (&buffer);
    3627      return (FALSE);
    3728
    3829    case PCLIENT_GOOD:
    39       gprint (GP_ERR, "message received (ResetJob)\n"); 
    40       FreeIOBuffer (&buffer);
     30      host[0].response_state = PCONTROL_RESP_RESET_JOB;
     31      host[0].response = PCLIENT_PROMPT;
     32      FlushIOBuffer (&host[0].comms_buffer, 0x100);
     33      PutHost (host, PCONTROL_HOST_RESP, STACK_BOTTOM);
    4134      return (TRUE);
    4235
    4336    default:
    44       gprint (GP_ERR, "unknown status for pclient command: programming error\n"); 
    45       pcontrol_exit (55);
     37      ABORT ("unknown status for pclient command"); 
    4638  }
     39  ABORT ("should not reach here (ResetJob)");
     40}
    4741
    48   gprint (GP_ERR, "programming error in ResetJob (should not reach here)\n");
    49   FreeIOBuffer (&buffer);
    50   pcontrol_exit (56);
    51   return (FALSE);
     42int ResetJobResponse (Host *host) {
     43 
     44  int       status;
     45  IOBuffer *buffer;
     46
     47  /* job must have assigned host */
     48  ASSERT (host, "missing host");
     49  ASSERT (host[0].job, "missing job");
     50  buffer = host[0].comms_buffer;
     51
     52  gprint (GP_ERR, "message received (ResetJob)\n"); 
     53  return (TRUE);
    5254}
    5355
Note: See TracChangeset for help on using the changeset viewer.