MEDIUM: proxy: replace proxy->state with proxy->disabled
The remaining proxy states were only used to distinguish an enabled
proxy from a disabled one. Due to the initialization order, both
PR_STNEW and PR_STREADY were equivalent after startup, and they
would only differ from PR_STSTOPPED when the proxy is disabled or
shutdown (which is effectively another way to disable it).
Now we just have a "disabled" field which allows to distinguish them.
It's becoming obvious that start_proxies() is only used to print a
greeting message now, that we'd rather get rid of. Probably that
zombify_proxy() and stop_proxy() should be merged once their
differences move to the right place.
diff --git a/src/cfgparse.c b/src/cfgparse.c
index 92d02ca..0bc4b82 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -414,7 +414,7 @@
{
init_new_proxy(&defproxy);
defproxy.mode = PR_MODE_TCP;
- defproxy.state = PR_STNEW;
+ defproxy.disabled = 0;
defproxy.maxconn = cfg_maxpconn;
defproxy.conn_retries = CONN_RETRIES;
defproxy.redispatch_after = 0;
@@ -2117,7 +2117,7 @@
if (!(from->cap & PR_CAP_FE))
return;
- if (from->state == PR_STSTOPPED)
+ if (from->disabled)
return;
/* default_backend */
@@ -2234,7 +2234,7 @@
next_pxid++;
- if (curproxy->state == PR_STSTOPPED) {
+ if (curproxy->disabled) {
/* ensure we don't keep listeners uselessly bound. We
* can't disable their listeners yet (fdtab not
* allocated yet) but let's skip them.
@@ -3949,7 +3949,7 @@
* other proxies.
*/
for (curproxy = proxies_list; curproxy; curproxy = curproxy->next) {
- if (curproxy->state == PR_STSTOPPED || !curproxy->table)
+ if (curproxy->disabled || !curproxy->table)
continue;
if (!stktable_init(curproxy->table)) {