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

    r16472 r17475  
    11# include "pcontrol.h"
    22
    3 Stack *HostPool_Idle;
    4 Stack *HostPool_Busy;
    5 Stack *HostPool_Done;
    6 Stack *HostPool_Down;
    7 Stack *HostPool_Off;
     3Stack *HostPool_Idle; // these hosts are waiting for something to do
     4Stack *HostPool_Busy; // these hosts are working
     5Stack *HostPool_Resp; // these hosts are trying to respond
     6Stack *HostPool_Done; // these hosts have finished a job
     7Stack *HostPool_Down; // these hosts are not responding
     8Stack *HostPool_Off;  // these hosts are off
    89
    910void InitHostStacks () {
    1011  HostPool_Idle = InitStack ();
    1112  HostPool_Busy = InitStack ();
     13  HostPool_Resp = InitStack ();
    1214  HostPool_Done = InitStack ();
    1315  HostPool_Down = InitStack ();
     
    2628  FreeHostStack (HostPool_Idle);
    2729  FreeHostStack (HostPool_Busy);
     30  FreeHostStack (HostPool_Resp);
    2831  FreeHostStack (HostPool_Done);
    2932  FreeHostStack (HostPool_Down);
     
    3538    case PCONTROL_HOST_IDLE: return ("IDLE");
    3639    case PCONTROL_HOST_DOWN: return ("DOWN");
     40    case PCONTROL_HOST_RESP: return ("RESP");
    3741    case PCONTROL_HOST_DONE: return ("DONE");
    3842    case PCONTROL_HOST_BUSY: return ("BUSY");
     
    4852    case PCONTROL_HOST_IDLE: return (HostPool_Idle);
    4953    case PCONTROL_HOST_DOWN: return (HostPool_Down);
     54    case PCONTROL_HOST_RESP: return (HostPool_Resp);
    5055    case PCONTROL_HOST_DONE: return (HostPool_Done);
    5156    case PCONTROL_HOST_BUSY: return (HostPool_Busy);
     
    6065  if (!strcasecmp (name, "idle")) return (HostPool_Idle);
    6166  if (!strcasecmp (name, "down")) return (HostPool_Down);
     67  if (!strcasecmp (name, "resp")) return (HostPool_Resp);
    6268  if (!strcasecmp (name, "done")) return (HostPool_Done);
    6369  if (!strcasecmp (name, "busy")) return (HostPool_Busy);
     
    94100  if (host != NULL) return (host);
    95101
     102  *StackID = PCONTROL_HOST_RESP;
     103  host = PullHostFromStackByID (*StackID, HostID);
     104  if (host != NULL) return (host);
     105
    96106  *StackID = PCONTROL_HOST_DONE;
    97107  host = PullHostFromStackByID (*StackID, HostID);
     
    120130
    121131  *StackID = PCONTROL_HOST_DOWN;
     132  host = PullHostFromStackByName (*StackID, name);
     133  if (host != NULL) return (host);
     134
     135  *StackID = PCONTROL_HOST_RESP;
    122136  host = PullHostFromStackByName (*StackID, name);
    123137  if (host != NULL) return (host);
     
    180194  host[0].nexttry.tv_usec = 0;
    181195
     196  InitIOBuffer (&host[0].comms_buffer, 0x100);
     197  host[0].response_state = PCONTROL_RESP_NONE;
     198  host[0].response = NULL;
     199
    182200  host[0].markoff  = FALSE;
    183201  host[0].job      = NULL;
     
    187205
    188206void DelHost (Host *host) {
     207  FreeIOBuffer (&host[0].comms_buffer);
    189208  FREE (host[0].hostname);
    190209  FREE (host[0].job);
Note: See TracChangeset for help on using the changeset viewer.