diff --git a/include/haproxy/proxy-t.h b/include/haproxy/proxy-t.h index f2a3e7d0b..a34752bba 100644 --- a/include/haproxy/proxy-t.h +++ b/include/haproxy/proxy-t.h @@ -200,6 +200,11 @@ enum PR_SRV_STATE_FILE { */ #define PR_RE_EARLY_ERROR 0x00010000 /* Retry if we failed at sending early data */ #define PR_RE_JUNK_REQUEST 0x00020000 /* We received an incomplete or garbage response */ + +/* disabled state */ +#define PR_DISABLED 0x1 /* The proxy was disabled in the configuration (not at runtime) */ +#define PR_STOPPED 0x2 /* The proxy was stopped */ + struct stream; struct http_snapshot { @@ -254,7 +259,7 @@ struct error_snapshot { struct proxy { enum obj_type obj_type; /* object type == OBJ_TYPE_PROXY */ - char disabled; /* non-zero if disabled or shutdown */ + char disabled; /* bit field PR_DISABLED | PR_STOPPED */ enum pr_mode mode; /* mode = PR_MODE_TCP, PR_MODE_HTTP, ... */ char cap; /* supported capabilities (PR_CAP_*) */ unsigned int maxconn; /* max # of active streams on the frontend */ diff --git a/src/cfgparse-listen.c b/src/cfgparse-listen.c index bdbb6030a..790566a62 100644 --- a/src/cfgparse-listen.c +++ b/src/cfgparse-listen.c @@ -593,7 +593,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) else if (strcmp(args[0], "disabled") == 0) { /* disables this proxy */ if (alertif_too_many_args(0, file, linenum, args, &err_code)) goto out; - curproxy->disabled = 1; + curproxy->disabled = PR_DISABLED; } else if (strcmp(args[0], "enabled") == 0) { /* enables this proxy (used to revert a disabled default) */ if (alertif_too_many_args(0, file, linenum, args, &err_code)) diff --git a/src/cfgparse.c b/src/cfgparse.c index 3ac31fc9b..f7eac9753 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -1018,7 +1018,7 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm) stktables_list = t; } else if (strcmp(args[0], "disabled") == 0) { /* disables this peers section */ - curpeers->disabled = 1; + curpeers->disabled = PR_DISABLED; } else if (strcmp(args[0], "enabled") == 0) { /* enables this peers section (used to revert a disabled default) */ curpeers->disabled = 0; diff --git a/src/mworker.c b/src/mworker.c index 7842db398..ca1cc7424 100644 --- a/src/mworker.c +++ b/src/mworker.c @@ -443,7 +443,7 @@ void mworker_cleanlisteners() } /* if the proxy shouldn't be in the master, we stop it */ if (!listen_in_master) - curproxy->disabled = 1; + curproxy->disabled = PR_DISABLED; } } diff --git a/src/proxy.c b/src/proxy.c index 245c22b9e..237f297d7 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -1801,7 +1801,7 @@ void proxy_cond_disable(struct proxy *p) if (p->li_ready + p->li_paused > 0) return; - p->disabled = 1; + p->disabled = PR_STOPPED; /* Note: syslog proxies use their own loggers so while it's somewhat OK * to report them being stopped as a warning, we must not spam their log @@ -2050,7 +2050,7 @@ void stop_proxy(struct proxy *p) if (!p->disabled && !p->li_ready) { /* might be just a backend */ - p->disabled = 1; + p->disabled |= PR_STOPPED; } HA_RWLOCK_WRUNLOCK(PROXY_LOCK, &p->lock);