]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: proxy: Introduce proxy flags to replace disabled bitfield
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 6 Oct 2021 12:24:19 +0000 (14:24 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 15 Oct 2021 12:12:19 +0000 (14:12 +0200)
This change is required to support TCP/HTTP rules in defaults sections. The
'disabled' bitfield in the proxy structure, used to know if a proxy is
disabled or stopped, is replaced a generic bitfield named 'flags'.

PR_DISABLED and PR_STOPPED flags are renamed to PR_FL_DISABLED and
PR_FL_STOPPED respectively. In addition, everywhere there is a test to know
if a proxy is disabled or stopped, there is now a bitwise AND operation on
PR_FL_DISABLED and/or PR_FL_STOPPED flags.

19 files changed:
addons/promex/service-prometheus.c
include/haproxy/backend.h
include/haproxy/proxy-t.h
src/cfgparse-listen.c
src/cfgparse.c
src/check.c
src/extcheck.c
src/filters.c
src/haproxy.c
src/mux_fcgi.c
src/mux_h1.c
src/mux_h2.c
src/mworker.c
src/proxy.c
src/server.c
src/server_state.c
src/stats.c
src/stick_table.c
src/stream.c

index 69fb26a1ea69f558e8983050ab5e79162f3e8bbe..221e407058437ec499334bc5de53f0b046c14220 100644 (file)
@@ -613,7 +613,7 @@ static int promex_dump_front_metrics(struct appctx *appctx, struct htx *htx)
                        labels[0].value = ist2(px->id, strlen(px->id));
 
                        /* skip the disabled proxies, global frontend and non-networked ones */
-                       if (px->disabled || px->uuid <= 0 || !(px->cap & PR_CAP_FE))
+                       if ((px->flags & PR_FL_DISABLED) || px->uuid <= 0 || !(px->cap & PR_CAP_FE))
                                goto next_px;
 
                        if (!stats_fill_fe_stats(px, stats, ST_F_TOTAL_FIELDS, &(appctx->st2)))
@@ -621,7 +621,7 @@ static int promex_dump_front_metrics(struct appctx *appctx, struct htx *htx)
 
                        switch (appctx->st2) {
                                case ST_F_STATUS:
-                                       state = !px->disabled;
+                                       state = !(px->flags & PR_FL_STOPPED);
                                        for (; appctx->ctx.stats.st_code < PROMEX_FRONT_STATE_COUNT; appctx->ctx.stats.st_code++) {
                                                labels[1].name = ist("state");
                                                labels[1].value = promex_front_st[appctx->ctx.stats.st_code];
@@ -714,7 +714,7 @@ static int promex_dump_listener_metrics(struct appctx *appctx, struct htx *htx)
                        labels[0].value = ist2(px->id, strlen(px->id));
 
                        /* skip the disabled proxies, global frontend and non-networked ones */
-                       if (px->disabled || px->uuid <= 0 || !(px->cap & PR_CAP_FE))
+                       if ((px->flags & PR_FL_DISABLED) || px->uuid <= 0 || !(px->cap & PR_CAP_FE))
                                goto next_px;
 
                        li = appctx->ctx.stats.obj2;
@@ -804,7 +804,7 @@ static int promex_dump_back_metrics(struct appctx *appctx, struct htx *htx)
                        labels[0].value = ist2(px->id, strlen(px->id));
 
                        /* skip the disabled proxies, global frontend and non-networked ones */
-                       if (px->disabled || px->uuid <= 0 || !(px->cap & PR_CAP_BE))
+                       if ((px->flags & PR_FL_DISABLED) || px->uuid <= 0 || !(px->cap & PR_CAP_BE))
                                goto next_px;
 
                        if (!stats_fill_be_stats(px, 0, stats, ST_F_TOTAL_FIELDS, &(appctx->st2)))
@@ -937,7 +937,7 @@ static int promex_dump_srv_metrics(struct appctx *appctx, struct htx *htx)
                        labels[0].value = ist2(px->id, strlen(px->id));
 
                        /* skip the disabled proxies, global frontend and non-networked ones */
-                       if (px->disabled || px->uuid <= 0 || !(px->cap & PR_CAP_BE))
+                       if ((px->flags & PR_FL_DISABLED) || px->uuid <= 0 || !(px->cap & PR_CAP_BE))
                                goto next_px;
 
                        while (appctx->ctx.stats.obj2) {
index 17dffac8a9907103ed7eb234249b0ce6995d0367..a6ac621dda5a1b62316ee7a7413742ed0fb20edb 100644 (file)
@@ -52,7 +52,7 @@ int be_lastsession(const struct proxy *be);
 /* Returns number of usable servers in backend */
 static inline int be_usable_srv(struct proxy *be)
 {
-        if (be->disabled)
+        if (be->flags & (PR_FL_DISABLED|PR_FL_STOPPED))
                 return 0;
         else if (be->srv_act)
                 return be->srv_act;
index 5ef47c3f437c9113311afd2722c9815cd42b59f7..c38c339c8c856623be891544825348f644d8acef 100644 (file)
@@ -200,9 +200,9 @@ 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 */
+/* Proxy flags */
+#define PR_FL_DISABLED           0x01  /* The proxy was disabled in the configuration (not at runtime) */
+#define PR_FL_STOPPED            0x02  /* The proxy was stopped */
 
 struct stream;
 
@@ -258,7 +258,7 @@ struct error_snapshot {
 
 struct proxy {
        enum obj_type obj_type;                 /* object type == OBJ_TYPE_PROXY */
-       char disabled;                          /* bit field PR_DISABLED | PR_STOPPED */
+       char flags;                             /* bit field PR_FL_* */
        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 */
index 6f526d4fd5ac75dad7fd834804a5b91e36c866d5..f6589d18b84d35c9690b7b30382333b60d88b144 100644 (file)
@@ -595,12 +595,12 @@ 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 |= PR_DISABLED;
+               curproxy->flags |= PR_FL_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))
                        goto out;
-               curproxy->disabled = 0;
+               curproxy->flags &= ~PR_FL_DISABLED;
        }
        else if (strcmp(args[0], "bind-process") == 0) {  /* enable this proxy only on some processes */
                int cur_arg = 1;
index e606a47bc9d4a1dbccb699f242d604f876cf13db..dbb55ed48aaf07312a9b2e6599d99eee9368ddc0 100644 (file)
@@ -1019,7 +1019,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 |= PR_DISABLED;
+               curpeers->disabled |= PR_FL_DISABLED;
        }
        else if (strcmp(args[0], "enabled") == 0) {  /* enables this peers section (used to revert a disabled default) */
                curpeers->disabled = 0;
@@ -2502,7 +2502,7 @@ int check_config_validity()
                if (curproxy->uuid >= 0)
                        next_pxid++;
 
-               if (curproxy->disabled) {
+               if (curproxy->flags & PR_FL_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.
@@ -3962,7 +3962,7 @@ out_uri_auth_compat:
         * other proxies.
         */
        for (curproxy = proxies_list; curproxy; curproxy = curproxy->next) {
-               if (curproxy->disabled || !curproxy->table)
+               if ((curproxy->flags & PR_FL_DISABLED) || !curproxy->table)
                        continue;
 
                if (!stktable_init(curproxy->table)) {
index ad6df9c6039985e66ad553c9cf2db919ffa5ef26..dd6a9517df4613f76ab974b109f12493a53acefb 100644 (file)
@@ -1117,7 +1117,7 @@ struct task *process_chk_conn(struct task *t, void *context, unsigned int state)
                 * is disabled.
                 */
                if (((check->state & (CHK_ST_ENABLED | CHK_ST_PAUSED)) != CHK_ST_ENABLED) ||
-                   proxy->disabled) {
+                   (proxy->flags & (PR_FL_DISABLED|PR_FL_STOPPED))) {
                        TRACE_STATE("health-check paused or disabled", CHK_EV_TASK_WAKE, check);
                        goto reschedule;
                }
index 5b0d3e9675c9a8fb0a776fb2059bf29988d94917..f517362ee73daa7fffbe4daabe3f8a4249b9a06d 100644 (file)
@@ -494,7 +494,7 @@ struct task *process_chk_proc(struct task *t, void *context, unsigned int state)
                 * is disabled.
                 */
                if (((check->state & (CHK_ST_ENABLED | CHK_ST_PAUSED)) != CHK_ST_ENABLED) ||
-                   s->proxy->disabled)
+                   (s->proxy->flags & (PR_FL_DISABLED|PR_FL_STOPPED)))
                        goto reschedule;
 
                /* we'll initiate a new check */
index f64c192bdbead6e90f82772865cb6c24ee2c240b..06ae788b9df6ae51314ac68be232bec8c2efc0a1 100644 (file)
@@ -292,7 +292,7 @@ flt_init_all()
        int err_code = ERR_NONE;
 
        for (px = proxies_list; px; px = px->next) {
-               if (px->disabled) {
+               if (px->flags & (PR_FL_DISABLED|PR_FL_STOPPED)) {
                        flt_deinit(px);
                        continue;
                }
@@ -315,7 +315,7 @@ flt_init_all_per_thread()
        int err_code = 0;
 
        for (px = proxies_list; px; px = px->next) {
-               if (px->disabled)
+               if (px->flags & (PR_FL_DISABLED|PR_FL_STOPPED))
                        continue;
 
                err_code = flt_init_per_thread(px);
index 7a4dc790e896e8c76fec71dc090018547b9e3f52..3c41c86fb255acdedafc7e4912b9e749a3b944d3 100644 (file)
@@ -1999,7 +1999,7 @@ static void init(int argc, char **argv)
                struct post_proxy_check_fct *ppcf;
                struct post_server_check_fct *pscf;
 
-               if (px->disabled)
+               if (px->flags & (PR_FL_DISABLED|PR_FL_STOPPED))
                        continue;
 
                list_for_each_entry(pscf, &post_server_check_list, list) {
@@ -2061,13 +2061,13 @@ static void init(int argc, char **argv)
                                break;
 
                for (px = proxies_list; px; px = px->next)
-                       if (!px->disabled && px->li_all)
+                       if (!(px->flags & (PR_FL_DISABLED|PR_FL_STOPPED)) && px->li_all)
                                break;
 
                if (!px) {
                        /* We may only have log-forward section */
                        for (px = cfg_log_forward; px; px = px->next)
-                               if (!px->disabled && px->li_all)
+                               if (!(px->flags & (PR_FL_DISABLED|PR_FL_STOPPED)) && px->li_all)
                                        break;
                }
 
@@ -2401,7 +2401,7 @@ static void init(int argc, char **argv)
 
        /* stop disabled proxies */
        for (px = proxies_list; px; px = px->next) {
-               if (px->disabled)
+               if (px->flags & (PR_FL_DISABLED|PR_FL_STOPPED))
                        stop_proxy(px);
        }
 
index 5fa75020433428c1c6c1a642e7ccc8794da99170..46ee5eddf5961451900be11d863a414214fd62b6 100644 (file)
@@ -3088,7 +3088,7 @@ static int fcgi_process(struct fcgi_conn *fconn)
        }
        fcgi_send(fconn);
 
-       if (unlikely(fconn->proxy->disabled)) {
+       if (unlikely(fconn->proxy->flags & (PR_FL_DISABLED|PR_FL_STOPPED))) {
                /* frontend is stopping, reload likely in progress, let's try
                 * to announce a graceful shutdown if not yet done. We don't
                 * care if it fails, it will be tried again later.
index 814b3fbfcb0e18c2c61aca9eed5e5db2b5e32237..8d2e21c748d3358413d120afe6f4047fae653826 100644 (file)
@@ -1023,7 +1023,7 @@ static void h1_set_cli_conn_mode(struct h1s *h1s, struct h1m *h1m)
        }
 
        /* If KAL, check if the frontend is stopping. If yes, switch in CLO mode */
-       if (h1s->flags & H1S_F_WANT_KAL && fe->disabled) {
+       if (h1s->flags & H1S_F_WANT_KAL && (fe->flags & (PR_FL_DISABLED|PR_FL_STOPPED))) {
                h1s->flags = (h1s->flags & ~H1S_F_WANT_MSK) | H1S_F_WANT_CLO;
                TRACE_STATE("stopping, set close mode", H1_EV_RX_DATA|H1_EV_RX_HDRS|H1_EV_TX_DATA|H1_EV_TX_HDRS, h1s->h1c->conn, h1s);
        }
@@ -1087,7 +1087,7 @@ static void h1_set_srv_conn_mode(struct h1s *h1s, struct h1m *h1m)
        }
 
        /* If KAL, check if the backend is stopping. If yes, switch in CLO mode */
-       if (h1s->flags & H1S_F_WANT_KAL && be->disabled) {
+       if (h1s->flags & H1S_F_WANT_KAL && (be->flags & (PR_FL_DISABLED|PR_FL_STOPPED))) {
                h1s->flags = (h1s->flags & ~H1S_F_WANT_MSK) | H1S_F_WANT_CLO;
                TRACE_STATE("stopping, set close mode", H1_EV_RX_DATA|H1_EV_RX_HDRS|H1_EV_TX_DATA|H1_EV_TX_HDRS, h1s->h1c->conn, h1s);
        }
@@ -2841,7 +2841,7 @@ static int h1_process(struct h1c * h1c)
         * Release idling front connection if this is the case.
         */
        if (!(h1c->flags & H1C_F_IS_BACK)) {
-               if (unlikely(h1c->px->disabled)) {
+               if (unlikely(h1c->px->flags & (PR_FL_DISABLED|PR_FL_STOPPED))) {
                        if (h1c->flags & H1C_F_WAIT_NEXT_REQ)
                                goto release;
                }
index f32766d0bf903dd1fa19520935c70680d575d7e7..03dbd54a104b6318c4bb44c36f6081e9dcdb2da1 100644 (file)
@@ -3925,7 +3925,7 @@ static int h2_process(struct h2c *h2c)
        }
        h2_send(h2c);
 
-       if (unlikely(h2c->proxy->disabled) && !(h2c->flags & H2_CF_IS_BACK)) {
+       if (unlikely(h2c->proxy->flags & (PR_FL_DISABLED|PR_FL_STOPPED)) && !(h2c->flags & H2_CF_IS_BACK)) {
                /* frontend is stopping, reload likely in progress, let's try
                 * to announce a graceful shutdown if not yet done. We don't
                 * care if it fails, it will be tried again later.
index 7c737801f66f10470a93fc7d74f3968db2fed96b..fb3adc08ff1cee676948123833008bc2477c0d1f 100644 (file)
@@ -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 |= PR_DISABLED;
+                       curproxy->flags |= PR_FL_DISABLED;
        }
 }
 
index 4dbf67111ea11c42d1c574f553aa26c00d0d2496..c99f3a53a5d44cebcc264cb7da339b5d263dafe7 100644 (file)
@@ -1364,7 +1364,7 @@ void init_new_proxy(struct proxy *p)
 void proxy_preset_defaults(struct proxy *defproxy)
 {
        defproxy->mode = PR_MODE_TCP;
-       defproxy->disabled = 0;
+       defproxy->flags = 0;
        if (!(defproxy->cap & PR_CAP_INT)) {
                defproxy->maxconn = cfg_maxpconn;
                defproxy->conn_retries = CONN_RETRIES;
@@ -1532,7 +1532,7 @@ static int proxy_defproxy_cpy(struct proxy *curproxy, const struct proxy *defpro
        /* set default values from the specified default proxy */
        memcpy(&curproxy->defsrv, &defproxy->defsrv, sizeof(curproxy->defsrv));
 
-       curproxy->disabled = defproxy->disabled;
+       curproxy->flags = defproxy->flags;
        curproxy->options = defproxy->options;
        curproxy->options2 = defproxy->options2;
        curproxy->no_options = defproxy->no_options;
@@ -1811,19 +1811,19 @@ struct proxy *parse_new_proxy(const char *name, unsigned int cap,
 }
 
 /* to be called under the proxy lock after stopping some listeners. This will
- * automatically update the p->disabled flag after stopping the last one, and
+ * automatically update the p->flags flag after stopping the last one, and
  * will emit a log indicating the proxy's condition. The function is idempotent
  * so that it will not emit multiple logs; a proxy will be disabled only once.
  */
 void proxy_cond_disable(struct proxy *p)
 {
-       if (p->disabled)
+       if (p->flags & (PR_FL_DISABLED|PR_FL_STOPPED))
                return;
 
        if (p->li_ready + p->li_paused > 0)
                return;
 
-       p->disabled |= PR_STOPPED;
+       p->flags |= PR_FL_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
@@ -1863,7 +1863,7 @@ struct task *manage_proxy(struct task *t, void *context, unsigned int state)
         */
 
        /* first, let's check if we need to stop the proxy */
-       if (unlikely(stopping && !p->disabled)) {
+       if (unlikely(stopping && !(p->flags & (PR_FL_DISABLED|PR_FL_STOPPED)))) {
                int t;
                t = tick_remain(now_ms, p->stop_time);
                if (t == 0) {
@@ -1883,7 +1883,7 @@ struct task *manage_proxy(struct task *t, void *context, unsigned int state)
         * be in neither list. Any entry being dumped will have ref_cnt > 0.
         * However we protect tables that are being synced to peers.
         */
-       if (unlikely(stopping && p->disabled && p->table && p->table->current)) {
+       if (unlikely(stopping && (p->flags & (PR_FL_DISABLED|PR_FL_STOPPED)) && p->table && p->table->current)) {
 
                if (!p->table->refcnt) {
                        /* !table->refcnt means there
@@ -2103,7 +2103,7 @@ int pause_proxy(struct proxy *p)
 {
        struct listener *l;
 
-       if (!(p->cap & PR_CAP_FE) || p->disabled || !p->li_ready)
+       if (!(p->cap & PR_CAP_FE) || (p->flags & (PR_FL_DISABLED|PR_FL_STOPPED)) || !p->li_ready)
                return 1;
 
        list_for_each_entry(l, &p->conf.listeners, by_fe)
@@ -2122,7 +2122,7 @@ int pause_proxy(struct proxy *p)
  * to be called when going down in order to release the ports so that another
  * process may bind to them. It must also be called on disabled proxies at the
  * end of start-up. If all listeners are closed, the proxy is set to the
- * PR_STSTOPPED state. The function takes the proxy's lock so it's safe to
+ * PR_STOPPED state. The function takes the proxy's lock so it's safe to
  * call from multiple places.
  */
 void stop_proxy(struct proxy *p)
@@ -2134,9 +2134,9 @@ void stop_proxy(struct proxy *p)
        list_for_each_entry(l, &p->conf.listeners, by_fe)
                stop_listener(l, 1, 0, 0);
 
-       if (!p->disabled && !p->li_ready) {
+       if (!(p->flags & (PR_FL_DISABLED|PR_FL_STOPPED)) && !p->li_ready) {
                /* might be just a backend */
-               p->disabled |= PR_STOPPED;
+               p->flags |= PR_FL_STOPPED;
        }
 
        HA_RWLOCK_WRUNLOCK(PROXY_LOCK, &p->lock);
@@ -2152,7 +2152,7 @@ int resume_proxy(struct proxy *p)
        struct listener *l;
        int fail;
 
-       if (p->disabled || !p->li_paused)
+       if ((p->flags & (PR_FL_DISABLED|PR_FL_STOPPED)) || !p->li_paused)
                return 1;
 
        fail = 0;
@@ -2372,7 +2372,7 @@ void proxy_adjust_all_maxconn()
        struct switching_rule *swrule1, *swrule2;
 
        for (curproxy = proxies_list; curproxy; curproxy = curproxy->next) {
-               if (curproxy->disabled)
+               if (curproxy->flags & (PR_FL_DISABLED|PR_FL_STOPPED))
                        continue;
 
                if (!(curproxy->cap & PR_CAP_FE))
@@ -2416,7 +2416,7 @@ void proxy_adjust_all_maxconn()
         * loop above because cross-references are not yet fully resolved.
         */
        for (curproxy = proxies_list; curproxy; curproxy = curproxy->next) {
-               if (curproxy->disabled)
+               if (curproxy->flags & (PR_FL_DISABLED|PR_FL_STOPPED))
                        continue;
 
                /* If <fullconn> is not set, let's set it to 10% of the sum of
@@ -2875,7 +2875,7 @@ static int cli_parse_shutdown_frontend(char **args, char *payload, struct appctx
        if (!px)
                return 1;
 
-       if (px->disabled)
+       if (px->flags & (PR_FL_DISABLED|PR_FL_STOPPED))
                return cli_msg(appctx, LOG_NOTICE, "Frontend was already shut down.\n");
 
        stop_proxy(px);
@@ -2898,7 +2898,7 @@ static int cli_parse_disable_frontend(char **args, char *payload, struct appctx
        if (!px)
                return 1;
 
-       if (px->disabled)
+       if (px->flags & (PR_FL_DISABLED|PR_FL_STOPPED))
                return cli_msg(appctx, LOG_NOTICE, "Frontend was previously shut down, cannot disable.\n");
 
        if (!px->li_ready)
@@ -2930,7 +2930,7 @@ static int cli_parse_enable_frontend(char **args, char *payload, struct appctx *
        if (!px)
                return 1;
 
-       if (px->disabled)
+       if (px->flags & (PR_FL_DISABLED|PR_FL_STOPPED))
                return cli_err(appctx, "Frontend was previously shut down, cannot enable.\n");
 
        if (px->li_ready == px->li_all)
index ca9a59363c78a707ec96edcb90f09bf6ad70129a..b8908cefaf2a03b5cf6d7be104385278416ffe5c 100644 (file)
@@ -3865,7 +3865,7 @@ int srv_init_addr(void)
                struct server *srv;
 
                /* servers are in backend only */
-               if (!(curproxy->cap & PR_CAP_BE) || curproxy->disabled)
+               if (!(curproxy->cap & PR_CAP_BE) || (curproxy->flags & (PR_FL_DISABLED|PR_FL_STOPPED)))
                        goto srv_init_addr_next;
 
                for (srv = curproxy->srv; srv; srv = srv->next) {
@@ -3954,7 +3954,7 @@ struct server *cli_find_server(struct appctx *appctx, char *arg)
                return NULL;
        }
 
-       if (px->disabled) {
+       if (px->flags & (PR_FL_DISABLED|PR_FL_STOPPED)) {
                cli_err(appctx, "Proxy is disabled.\n");
                return NULL;
        }
index a831d571002c5847f82c6e2ea40f7b5b30f4bdfe..dcbbe41a050fe9223433fba0da45c61bf3dfe400 100644 (file)
@@ -830,7 +830,7 @@ void apply_server_state(void)
                struct eb_root local_state_tree = EB_ROOT_UNIQUE;
 
                /* Must be an enabled backend with at least a server */
-               if (!(curproxy->cap & PR_CAP_BE) || curproxy->disabled || !curproxy->srv)
+               if (!(curproxy->cap & PR_CAP_BE) || (curproxy->flags & (PR_FL_DISABLED|PR_FL_STOPPED)) || !curproxy->srv)
                        continue; /* next proxy */
 
                /* Mode must be specified */
index bc083deace828dbcd02007a2431f2bfe9d4cdc51..2705a17e39d1ca483719805f710e293a07d9342a 100644 (file)
@@ -1695,7 +1695,7 @@ int stats_fill_fe_stats(struct proxy *px, struct field *stats, int len,
                                metric = mkf_u64(FN_COUNTER, px->fe_counters.denied_sess);
                                break;
                        case ST_F_STATUS:
-                               metric = mkf_str(FO_STATUS, px->disabled ? "STOP" : "OPEN");
+                               metric = mkf_str(FO_STATUS, (px->flags & (PR_FL_DISABLED|PR_FL_STOPPED)) ? "STOP" : "OPEN");
                                break;
                        case ST_F_PID:
                                metric = mkf_u32(FO_KEY, 1);
@@ -3678,7 +3678,7 @@ static int stats_dump_proxies(struct stream_interface *si,
                 * Also skip proxies that were disabled in the configuration
                 * This change allows retrieving stats from "old" proxies after a reload.
                 */
-               if (!(px->disabled & PR_DISABLED) && px->uuid > 0 &&
+               if (!(px->flags & PR_FL_DISABLED) && px->uuid > 0 &&
                    (px->cap & (PR_CAP_FE | PR_CAP_BE)) && !(px->cap & PR_CAP_INT)) {
                        if (stats_dump_proxy_to_buffer(si, htx, px, uri) == 0)
                                return 0;
@@ -4091,7 +4091,7 @@ static int stats_process_http_post(struct stream_interface *si)
                                                total_servers++;
                                                break;
                                        case ST_ADM_ACTION_SHUTDOWN:
-                                               if (!px->disabled) {
+                                               if (!(px->flags & (PR_FL_DISABLED|PR_FL_STOPPED))) {
                                                        srv_shutdown_streams(sv, SF_ERR_KILLED);
                                                        altered_servers++;
                                                        total_servers++;
index 4936677072ba4f4b5998a485543662b48ca6cfad..ae22b8349bb203f4e7f09de424b589b3a8986654 100644 (file)
@@ -654,7 +654,7 @@ int stktable_init(struct stktable *t)
                        t->exp_task->process = process_table_expire;
                        t->exp_task->context = (void *)t;
                }
-               if (t->peers.p && t->peers.p->peers_fe && !t->peers.p->peers_fe->disabled) {
+               if (t->peers.p && t->peers.p->peers_fe && !(t->peers.p->peers_fe->flags & (PR_FL_DISABLED|PR_FL_STOPPED))) {
                        peers_retval = peers_register_table(t->peers.p, t);
                }
 
index 4fc22b81c5a08d7012e7b3b06ecc35a051394ca6..c2e3ff9ff50eb36e3ebd75d7b15da06e48fcd780 100644 (file)
@@ -747,7 +747,7 @@ static void stream_free(struct stream *s)
        pool_free(pool_head_stream, s);
 
        /* We may want to free the maximum amount of pools if the proxy is stopping */
-       if (fe && unlikely(fe->disabled)) {
+       if (fe && unlikely(fe->flags & (PR_FL_DISABLED|PR_FL_STOPPED))) {
                pool_flush(pool_head_buffer);
                pool_flush(pool_head_http_txn);
                pool_flush(pool_head_requri);