IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 3, 2008, 10:26:51 PM (18 years ago)
Author:
eugene
Message:

updates from HEAD

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20080421/Ohana/src/opihi/pcontrol/CheckSystem.c

    r16589 r18424  
    9999
    100100    if (RunLevel != PCONTROL_RUN_NONE) {
     101      Nhostchecks += CheckRespHosts(0.020); /* check for incoming messages */
     102      TestCheckPoint ();
    101103      Nhostchecks += CheckDoneHosts(0.020); /* reset the host */
    102104      TestCheckPoint ();
     
    258260}
    259261
     262int CheckRespHosts (float MaxDelay) {
     263
     264  struct timeval start, stop;
     265  int i, Nobject;
     266  Stack *hoststack;
     267  Stack *jobstack;
     268  Host *host;
     269  Job *job;
     270  float dtime;
     271
     272  /* Loop through objects on the stack, no more than once. see note above */
     273  hoststack = GetHostStack (PCONTROL_HOST_RESP);
     274  jobstack = GetJobStack (PCONTROL_JOB_RESP);
     275  Nobject = hoststack[0].Nobject;
     276
     277  /* always allow at least one test */
     278  gettimeofday (&start, (void *) NULL);
     279  dtime = 0.0;
     280  for (i = 0; (i < Nobject) && (dtime < MaxDelay); i++) {
     281    LockStack (jobstack);
     282    host = PullStackByLocation (hoststack, STACK_TOP);
     283    if (host == NULL) {
     284        UnlockStack (jobstack);
     285        break;
     286    }
     287
     288    // if the host has a job, we need to pull the job from its stack
     289    job = (Job *) host[0].job;
     290    if (job != NULL) {
     291        RemoveStackByID (jobstack, job[0].JobID);
     292    }
     293    UnlockStack (jobstack);
     294
     295    CheckRespHost (host);
     296    gettimeofday (&stop, (void *) NULL);
     297    dtime = DTIME (stop, start);
     298  }
     299  if (DEBUG) gprint (GP_ERR, "checked %d hosts\n", i);
     300  return (i);
     301}
     302
    260303int CheckDoneHosts (float MaxDelay) {
    261304
     
    303346    if (host == NULL) break;
    304347    if (host[0].markoff) {
     348      // DOWN -> OFF
    305349      host[0].markoff = FALSE;
    306350      OffHost (host);
     
    311355      PutHost (host, PCONTROL_HOST_DOWN, STACK_BOTTOM);
    312356    } else {
     357      // DOWN -> IDLE (maybe)
     358      // this is a race condition with "host retry", but the only
     359      // consequence is that both StartHost and reset set the times to 0.0
    313360      StartHost (host);
    314361    }
Note: See TracChangeset for help on using the changeset viewer.