MINOR: stats: use the admin flags for soft enable/disable/stop/start on the web page
Instead of changing the weight to zero or enforcing maintenance mode, we
now make use of the new MAINT/DRAIN flags which are correctly propagated.
diff --git a/src/dumpstats.c b/src/dumpstats.c
index 3404bfe..cca1d12 100644
--- a/src/dumpstats.c
+++ b/src/dumpstats.c
@@ -4241,30 +4241,32 @@
else if ((sv = findserver(px, value)) != NULL) {
switch (action) {
case ST_ADM_ACTION_DISABLE:
- if ((px->state != PR_STSTOPPED) && !(sv->admin & SRV_ADMF_FMAINT)) {
+ if (!(sv->admin & SRV_ADMF_FMAINT)) {
altered_servers++;
total_servers++;
- srv_adm_set_maint(sv);
+ srv_set_admin_flag(sv, SRV_ADMF_FMAINT);
}
break;
case ST_ADM_ACTION_ENABLE:
- if ((px->state != PR_STSTOPPED) && (sv->admin & SRV_ADMF_FMAINT)) {
+ if (sv->admin & SRV_ADMF_FMAINT) {
altered_servers++;
total_servers++;
- srv_adm_set_ready(sv);
+ srv_clr_admin_flag(sv, SRV_ADMF_FMAINT);
}
break;
case ST_ADM_ACTION_STOP:
+ if (!(sv->admin & SRV_ADMF_FDRAIN)) {
+ srv_set_admin_flag(sv, SRV_ADMF_FDRAIN);
+ altered_servers++;
+ total_servers++;
+ }
+ break;
case ST_ADM_ACTION_START:
- if (action == ST_ADM_ACTION_START)
- sv->uweight = sv->iweight;
- else
- sv->uweight = 0;
-
- server_recalc_eweight(sv);
-
- altered_servers++;
- total_servers++;
+ if (sv->admin & SRV_ADMF_FDRAIN) {
+ srv_clr_admin_flag(sv, SRV_ADMF_FDRAIN);
+ altered_servers++;
+ total_servers++;
+ }
break;
case ST_ADM_ACTION_SHUTDOWN:
if (px->state != PR_STSTOPPED) {