Split out the retry count for unknown hosts so that it doesn't get
modified by duplicate logged messages. Also reset the retry timeout
every time we retry so that we don't just retry lots of times after
the first three minute timeout.
Signed-off-by: John Haxby <john.haxby_at_oracle.com>
--- syslogd.c | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/syslogd.c b/syslogd.c index 249f1e4..2829342 100644 --- a/syslogd.c +++ b/syslogd.c @@ -689,6 +689,7 @@ struct filed { int f_prevlen; /* length of f_prevline */ int f_prevcount; /* repetition cnt of prevline */ int f_repeatcount; /* number of "repeated" msgs */ + int f_retrycount; /* retry count for F_FORW_UNKN */ int f_flags; /* store some additional flags */ }; @@ -1878,24 +1879,25 @@ void fprintlog(f, from, flags, msg) dprintf(" %s\n", f->f_un.f_forw.f_hname); fwd_suspend = time((time_t *) 0) - f->f_time; if ( fwd_suspend >= INET_SUSPEND_TIME ) { + f->f_time = time((time_t *) 0); dprintf("Forwarding suspension to unknown over, retrying\n"); memset(&hints, 0, sizeof(hints)); hints.ai_family = family; hints.ai_socktype = SOCK_DGRAM; if ((err = getaddrinfo(f->f_un.f_forw.f_hname, "syslog", &hints, &ai))) { dprintf("Failure: %s\n", gai_strerror(err)); - dprintf("Retries: %d\n", f->f_prevcount); - if ( --f->f_prevcount < 0 ) { + dprintf("Retries: %d\n", f->f_retrycount); + if ( --f->f_retrycount <= 0 ) { dprintf("Giving up.\n"); f->f_type = F_UNUSED; + exit(0); } else - dprintf("Left retries: %d\n", f->f_prevcount); + dprintf("Left retries: %d\n", f->f_retrycount); } else { dprintf("%s found, resuming.\n", f->f_un.f_forw.f_hname); f->f_un.f_forw.f_addr = ai; - f->f_prevcount = 0; f->f_type = F_FORW; goto f_forw; } @@ -2844,7 +2846,7 @@ void cfline(line, f) * later, like FORW_SUSP. */ f->f_type = F_FORW_UNKN; - f->f_prevcount = INET_RETRY_MAX; + f->f_retrycount = INET_RETRY_MAX; f->f_time = time ( (time_t *)0 ); f->f_un.f_forw.f_addr = NULL; } else { -- 1.7.1.1Received on Fri Jul 23 2010 - 11:42:14 CEST
This archive was generated by hypermail 2.2.0 : Fri Jul 23 2010 - 11:42:54 CEST