IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 18079


Ignore:
Timestamp:
Jun 10, 2008, 5:24:11 PM (18 years ago)
Author:
eugene
Message:

handle comm errors; extend timeouts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/pantasks/ControllerOps.c

    r13581 r18079  
    11# include "pantasks.h"
    22/* adding a new host can delay controller up to a second or so */
    3 # define CONTROLLER_TIMEOUT 1000
    4 # define CONNECT_TIMEOUT 300
     3# define CONTROLLER_TIMEOUT 5000
     4# define CONNECT_TIMEOUT 1000
    55
    66/* local static variables to hold the connection to the controller */
     
    8888  /** parse status message **/
    8989  p = memstr (buffer.buffer, "STATUS",   buffer.Nbuffer);
     90  if (p == NULL) goto escape;
    9091  sscanf (p, "%*s %s", status_string);
    9192  p = memstr (buffer.buffer, "EXITST",   buffer.Nbuffer);
     93  if (p == NULL) goto escape;
    9294  sscanf (p, "%*s %d", &job[0].exit_status);
    9395  p = memstr (buffer.buffer, "STDOUT",   buffer.Nbuffer);
     96  if (p == NULL) goto escape;
    9497  sscanf (p, "%*s %d", &job[0].stdout_size);
    9598  p = memstr (buffer.buffer, "STDERR",   buffer.Nbuffer);
     99  if (p == NULL) goto escape;
    96100  sscanf (p, "%*s %d", &job[0].stderr_size);
    97101  p = memstr (buffer.buffer, "DTIME",    buffer.Nbuffer);
     102  if (p == NULL) goto escape;
    98103  sscanf (p, "%*s %lf", &job[0].dtime);
    99104  p = memstr (buffer.buffer, "HOSTNAME", buffer.Nbuffer);
     105  if (p == NULL) goto escape;
    100106  sscanf (p, "%*s %s", string);
    101107  job[0].realhost = strcreate (string);
     
    109115  if (!strcmp(status_string, "EXIT"))    outstate = JOB_EXIT;
    110116  if (!strcmp(status_string, "CRASH"))   outstate = JOB_CRASH;
    111   if (outstate == -1) {
    112     gprint (GP_ERR, "programming error?\n");
    113     exit (1);
    114   }
     117  if (outstate == -1) goto escape;
     118
    115119  job[0].state = outstate;
    116120  return (TRUE);
     121
     122  escape:
     123  gprint (GP_ERR, "garbage in pcontrol reponse\n");
     124  FreeIOBuffer (&buffer);
     125  return (FALSE);
    117126}
    118127
     
    297306    status = ReadtoIOBuffer (&buffer, stdout_fd[0]);
    298307    p = memstr (buffer.buffer, "CONNECTED", buffer.Nbuffer);
    299     usleep (10000); // wait for controller to start up
     308    usleep (50000); // wait for controller to start up
    300309  }
    301310  if (status == 0) goto pipe_error;
Note: See TracChangeset for help on using the changeset viewer.