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
This commit is contained in:
Hajimu UMEMOTO 2000-08-10 17:10:57 +00:00
parent aef2860eef
commit 2368b03bf4

View File

@ -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);