MINOR: server: do not emit warnings/logs/alerts on server state changes at boot
We'll have to use srv_set_admin_flag() to propagate some server flags
during the startup, and we don't want the resulting actions to cause
warnings, logs nor e-mail alerts to be generated since we're just applying
the config or a state file. So let's condition these notifications to the
fact that we're starting.
diff --git a/src/server.c b/src/server.c
index 3be2bc8..cc1f0d1 100644
--- a/src/server.c
+++ b/src/server.c
@@ -430,8 +430,10 @@
srv_append_status(&trash, s, NULL, -1, (mode & SRV_ADMF_FMAINT));
- Warning("%s.\n", trash.str);
- send_log(s->proxy, LOG_NOTICE, "%s.\n", trash.str);
+ if (!(global.mode & MODE_STARTING)) {
+ Warning("%s.\n", trash.str);
+ send_log(s->proxy, LOG_NOTICE, "%s.\n", trash.str);
+ }
}
else { /* server was still running */
int srv_was_stopping = (s->state == SRV_ST_STOPPING) || (s->admin & SRV_ADMF_DRAIN);
@@ -459,8 +461,10 @@
srv_append_status(&trash, s, NULL, xferred, (mode & SRV_ADMF_FMAINT));
- Warning("%s.\n", trash.str);
- send_log(s->proxy, srv_was_stopping ? LOG_NOTICE : LOG_ALERT, "%s.\n", trash.str);
+ if (!(global.mode & MODE_STARTING)) {
+ Warning("%s.\n", trash.str);
+ send_log(s->proxy, srv_was_stopping ? LOG_NOTICE : LOG_ALERT, "%s.\n", trash.str);
+ }
if (prev_srv_count && s->proxy->srv_bck == 0 && s->proxy->srv_act == 0)
set_backend_down(s->proxy);
@@ -488,10 +492,11 @@
srv_append_status(&trash, s, NULL, xferred, (mode & SRV_ADMF_FDRAIN));
- Warning("%s.\n", trash.str);
- send_log(s->proxy, LOG_NOTICE, "%s.\n", trash.str);
- send_email_alert(s, LOG_NOTICE, "%s", trash.str);
-
+ if (!(global.mode & MODE_STARTING)) {
+ Warning("%s.\n", trash.str);
+ send_log(s->proxy, LOG_NOTICE, "%s.\n", trash.str);
+ send_email_alert(s, LOG_NOTICE, "%s", trash.str);
+ }
if (prev_srv_count && s->proxy->srv_bck == 0 && s->proxy->srv_act == 0)
set_backend_down(s->proxy);
}