diff options
author | ume <ume@FreeBSD.org> | 2000-08-10 17:10:57 +0000 |
---|---|---|
committer | ume <ume@FreeBSD.org> | 2000-08-10 17:10:57 +0000 |
commit | d4ba157d9f0f1b12ba582a82dcc12eea9f72f8d8 (patch) | |
tree | 7e560edb79d309dde3e44de3327eabb46610a6c5 /lib/libc | |
parent | a8dda559a0824e4030837d56dfe4849799d07a9a (diff) | |
download | FreeBSD-src-d4ba157d9f0f1b12ba582a82dcc12eea9f72f8d8.zip FreeBSD-src-d4ba157d9f0f1b12ba582a82dcc12eea9f72f8d8.tar.gz |
Don't retry connecting via the same medium.
I changed to close to original code before merging IPv6 support.
It seems having delay before another try is useless. However, I'm
not sure that delay means. So, I leave it as-is.
PR: bin/20515
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/net/rcmd.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/lib/libc/net/rcmd.c b/lib/libc/net/rcmd.c index 34d6507..de2aed0 100644 --- a/lib/libc/net/rcmd.c +++ b/lib/libc/net/rcmd.c @@ -100,7 +100,6 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af) pid_t pid; int s, aport, lport, timo, error; char c; - int refused; char num[8]; static char canonnamebuf[MAXDNAME]; /* is it proper here? */ @@ -128,7 +127,6 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af) *ahost = canonnamebuf; } ai = res; - refused = 0; oldmask = sigblock(sigmask(SIGURG)); for (timo = 1, lport = IPPORT_RESERVED - 1;;) { s = rresvport_af(&lport, ai->ai_family); @@ -155,8 +153,14 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af) lport--; continue; } - if (errno == ECONNREFUSED) - refused = 1; + if (errno == ECONNREFUSED && timo <= 16) { + struct timespec time_to_sleep, time_remaining; + + time_to_sleep.tv_sec = timo; + time_to_sleep.tv_nsec = 0; + (void)_nanosleep(&time_to_sleep, &time_remaining); + timo *= 2; + } if (ai->ai_next != NULL) { int oerrno = errno; @@ -176,18 +180,6 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af) fprintf(stderr, "Trying %s...\n", paddr); continue; } - if (refused && timo <= 16) { - struct timespec time_to_sleep, time_remaining; - - time_to_sleep.tv_sec = timo; - time_to_sleep.tv_nsec = 0; - (void)_nanosleep(&time_to_sleep, &time_remaining); - - timo *= 2; - ai = res; - refused = 0; - continue; - } (void)fprintf(stderr, "%s: %s\n", *ahost, strerror(errno)); freeaddrinfo(res); sigsetmask(oldmask); |