IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 13, 2005, 10:30:13 AM (21 years ago)
Author:
eugene
Message:

working on speed issues

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/pcontrol/rconnect.c

    r4705 r4762  
    11# include "pcontrol.h"
    22
    3 # define CONNECT_TIMEOUT 300
     3/* connection can take a while, allow up to 2 sec */
     4# define CONNECT_TIMEOUT 200
    45
    56/* connect to host, start the shell: ssh hostname pclient -> command hostname shell
     
    1516  char **argv;
    1617  IOBuffer buffer;
     18  struct timespec request, remain;
    1719
    1820  bzero (stdin_fd,  2*sizeof(int));
     
    7981    status = ReadtoIOBuffer (&buffer, stdout_fd[0]);
    8082    p = memstr (buffer.buffer, "CONNECTED", buffer.Nbuffer);
    81     usleep (20000);
     83    usleep (10000);
    8284  }
    8385  if (status == 0) goto connect_error;
     
    101103  if (VerboseMode()) fprintf (stderr, "error while connecting\n");
    102104
     105  /* avoid blocking on waitpid, test every 100 usec, up to 50 msec */
     106  request.tv_sec = 0;
     107  request.tv_nsec = 100000;
     108
    103109  /* harvest the child process: kill & wait (< 100 ms) for exit */
    104110  kill (pid, SIGKILL);
    105111  result = waitpid (pid, &waitstatus, WNOHANG);
    106   for (i = 0; (i < 10) && (result == 0); i++) {
    107     usleep (10000);  /* 10 ms is min */
     112  for (i = 0; (i < 50) && (result == 0); i++) {
     113    nanosleep (&request, &remain);
    108114    result = waitpid (pid, &waitstatus, WNOHANG);
    109115  }
Note: See TracChangeset for help on using the changeset viewer.