Don't give up on a remote log host when we get a EHOSTUNREACH or

EHOSTDOWN. These are often transient errors (when the remote host
reboots, temporary network problems, etc.), and we'd rather err on the
side of caution and keep trying send messages that never arrive than
just give up.

Note that this is not an implementation of the "back-off" methods
given in the PR. Those just seem too complicated. Why not just keep
trying each time? Trying and failing doesn't really consume
significantly more resources than if we were successful for each
message.

PR:		bin/31029
MFC after:	1 week
This commit is contained in:
Crist J. Clark 2002-08-25 06:05:25 +00:00
parent 0b3a80af0d
commit fcfce9770f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=102401

View File

@ -1048,12 +1048,29 @@ fprintlog(struct filed *f, int flags, const char *msg)
if (lsent == l && !send_to_all)
break;
}
dprintf("lsent/l: %d/%d\n", lsent, l);
if (lsent != l) {
int e = errno;
(void)close(f->f_file);
errno = e;
f->f_type = F_UNUSED;
logerror("sendto");
errno = e;
switch (errno) {
case EHOSTUNREACH:
case EHOSTDOWN:
break;
/* case EBADF: */
/* case EACCES: */
/* case ENOTSOCK: */
/* case EFAULT: */
/* case EMSGSIZE: */
/* case EAGAIN: */
/* case ENOBUFS: */
/* case ECONNREFUSED: */
default:
dprintf("removing entry\n", e);
(void)close(f->f_file);
f->f_type = F_UNUSED;
break;
}
}
}
break;