Fix SMTP checker adding himself repeatedly in the list of failed checkers
authorVincent Bernat <bernat@luffy.cx>
Tue, 24 Nov 2009 12:59:43 +0000 (12:59 +0000)
committerAlexandre Cassen <acassen@freebox.fr>
Thu, 6 May 2010 13:02:06 +0000 (15:02 +0200)
When a SMTP check has already failed, SMTP checker will add itself
again to the list of failed checks. For example, if the check fails 10
times in a row, the SMTP check will be present 10 times in the list of
failed checks. This means that to be considered alive again, it should
succeed 10 times.

Other checkers just add themselves to the list of failed checkers only
if they are not already present. We do the same here.

keepalived/check/check_smtp.c

index 29c55e8..edae298 100644 (file)
@@ -329,10 +329,9 @@ smtp_final(thread *thread_obj, int error, const char *format, ...)
 
                        smtp_buff[542 - 1] = '\0';
                        smtp_alert(chk->rs, NULL, NULL, "DOWN", smtp_buff);
+                       update_svr_checker_state(DOWN, chk->id, chk->vs, chk->rs);
                }
 
-               update_svr_checker_state(DOWN, chk->id, chk->vs, chk->rs);
-
                /* Reset everything back to the first host in the list */
                smtp_chk->attempts = 0;
                smtp_chk->host_ctr = 0;