Changeset 4762 for trunk/Ohana/src/opihi/pcontrol/rconnect.c
- Timestamp:
- Aug 13, 2005, 10:30:13 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/pcontrol/rconnect.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/pcontrol/rconnect.c
r4705 r4762 1 1 # include "pcontrol.h" 2 2 3 # define CONNECT_TIMEOUT 300 3 /* connection can take a while, allow up to 2 sec */ 4 # define CONNECT_TIMEOUT 200 4 5 5 6 /* connect to host, start the shell: ssh hostname pclient -> command hostname shell … … 15 16 char **argv; 16 17 IOBuffer buffer; 18 struct timespec request, remain; 17 19 18 20 bzero (stdin_fd, 2*sizeof(int)); … … 79 81 status = ReadtoIOBuffer (&buffer, stdout_fd[0]); 80 82 p = memstr (buffer.buffer, "CONNECTED", buffer.Nbuffer); 81 usleep ( 20000);83 usleep (10000); 82 84 } 83 85 if (status == 0) goto connect_error; … … 101 103 if (VerboseMode()) fprintf (stderr, "error while connecting\n"); 102 104 105 /* avoid blocking on waitpid, test every 100 usec, up to 50 msec */ 106 request.tv_sec = 0; 107 request.tv_nsec = 100000; 108 103 109 /* harvest the child process: kill & wait (< 100 ms) for exit */ 104 110 kill (pid, SIGKILL); 105 111 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); 108 114 result = waitpid (pid, &waitstatus, WNOHANG); 109 115 }
Note:
See TracChangeset
for help on using the changeset viewer.
