From fcfce9770ffddb5c0af9066e6a06a5a73c6fc265 Mon Sep 17 00:00:00 2001 From: "Crist J. Clark" Date: Sun, 25 Aug 2002 06:05:25 +0000 Subject: 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 --- usr.sbin/syslogd/syslogd.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'usr.sbin/syslogd') diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index 2405748a5ace..b2693874dd3e 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -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; -- cgit v1.3