diff options
author | cjc <cjc@FreeBSD.org> | 2002-08-25 06:05:25 +0000 |
---|---|---|
committer | cjc <cjc@FreeBSD.org> | 2002-08-25 06:05:25 +0000 |
commit | abd6ef614697a337ee8fb816784aac80409d0f50 (patch) | |
tree | 6a8991654ebbf3ce430d79063c12f548aecad1ce /usr.sbin/syslogd/syslogd.c | |
parent | e4a8f19dec8e7787e97565378dda14ef8f6ea854 (diff) | |
download | FreeBSD-src-abd6ef614697a337ee8fb816784aac80409d0f50.zip FreeBSD-src-abd6ef614697a337ee8fb816784aac80409d0f50.tar.gz |
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
Diffstat (limited to 'usr.sbin/syslogd/syslogd.c')
-rw-r--r-- | usr.sbin/syslogd/syslogd.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index 2405748..b269387 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; |