IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 11446


Ignore:
Timestamp:
Jan 30, 2007, 1:07:29 PM (19 years ago)
Author:
eugene
Message:

longer timeout

File:
1 edited

Legend:

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

    r11445 r11446  
    333333int ControllerCommand (char *cmd, char *response, IOBuffer *buffer) {
    334334
    335   int i, status;
     335  int i, j, status;
    336336  char *line;
    337337  struct timespec request, remain;
     
    355355  line = NULL;
    356356  status = -1;
    357   for (i = 0; (i < CONTROLLER_TIMEOUT) && (status != 0) && (line == NULL); i++) {
    358     status = ReadtoIOBuffer (buffer, stdout_cntl);
    359     line = memstr (buffer[0].buffer, response, buffer[0].Nbuffer);
    360     if (status == -1) nanosleep (&request, &remain);
    361   }
    362   if (status ==  0) {
    363     StopController ();
    364     gprint (GP_ERR, "controller is down\n");
    365     return (FALSE);
     357  for (j = 0; (status == -1) && (j < 10); j++) {
     358      for (i = 0; (i < CONTROLLER_TIMEOUT) && (status != 0) && (line == NULL); i++) {
     359          status = ReadtoIOBuffer (buffer, stdout_cntl);
     360          line = memstr (buffer[0].buffer, response, buffer[0].Nbuffer);
     361          if (status == -1) nanosleep (&request, &remain);
     362      }
     363      if (status ==  0) {
     364          StopController ();
     365          gprint (GP_ERR, "controller is down\n");
     366          return (FALSE);
     367      }
     368      if (status == -1) {
     369          gprint (GP_ERR, "controller is not responding\n");
     370          gwrite (buffer[0].buffer, 1, buffer[0].Nbuffer, GP_ERR);
     371      }
    366372  }
    367373  if (status == -1) {
    368     gprint (GP_ERR, "controller is not responding\n");
    369     gwrite (buffer[0].buffer, 1, buffer[0].Nbuffer, GP_ERR);
    370     return (FALSE);
     374      gprint (GP_ERR, "controller still not responding, giving up\n");
     375      return (FALSE);
    371376  }
    372377
Note: See TracChangeset for help on using the changeset viewer.