diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/rccexternal.c | 20 | 
1 files changed, 16 insertions, 4 deletions
| diff --git a/src/rccexternal.c b/src/rccexternal.c index 6a81c56..be9f97d 100644 --- a/src/rccexternal.c +++ b/src/rccexternal.c @@ -79,13 +79,25 @@ int rccExternalInit() {  }  void rccExternalFree() { +    int retry; +    pid_t res; +    struct timespec timeout = { 0, 5000000 }; +      if (pid == (pid_t)-1) return; -     -    rccExternalConnect(0);     -    if (addr) free(addr); -    waitpid(pid, NULL, 0); +    for (retry = 0; retry < 3; retry++) { +	rccExternalConnect(0);     +	 +	nanosleep(&timeout, NULL); +	 +	res = waitpid(pid, NULL, WNOHANG); +	if (res) break; +	else timeout.tv_nsec*10; +    } +      pid = (pid_t)-1; +    if (addr) free(addr); +  }  static int rccExternalSetDeadline(struct timeval *tv, unsigned long timeout) { | 
