]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: proxy: remove the PR_STERROR state
authorWilly Tarreau <w@1wt.eu>
Thu, 24 Sep 2020 05:44:34 +0000 (07:44 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 9 Oct 2020 09:27:30 +0000 (11:27 +0200)
This state is only set when a pause() fails but isn't even set when a
resume() fails. And we cannot recover from this state. Instead, let's
just count remaining ready listeners to decide to emit an error or not.
It's more accurate and will better support new attempts if needed.

include/haproxy/proxy-t.h
src/proxy.c

index f0c61b3b7aa2dd338197e52c6efde53ca76ffa10..f2fdf01d51971a5b653448d10b9301141c3e0cb7 100644 (file)
@@ -48,7 +48,6 @@ enum pr_state {
        PR_STREADY,             /* proxy has been initialized and is ready */
        PR_STPAUSED,            /* frontend is paused (during hot restart) */
        PR_STSTOPPED,           /* proxy is stopped (end of a restart) */
-       PR_STERROR,             /* proxy experienced an unrecoverable error */
 } __attribute__((packed));
 
 /* values for proxy->mode */
index d3c207e7178d716e053edcd593374c8a2f969e7a..06fb0d9f6f89726d623d91acb2a95b98cc660628 100644 (file)
@@ -1281,28 +1281,24 @@ void soft_stop(void)
 
 
 /* Temporarily disables listening on all of the proxy's listeners. Upon
- * success, the proxy enters the PR_PAUSED state. If disabling at least one
- * listener returns an error, then the proxy state is set to PR_STERROR
- * because we don't know how to resume from this. The function returns 0
+ * success, the proxy enters the PR_PAUSED state. The function returns 0
  * if it fails, or non-zero on success.
  */
 int pause_proxy(struct proxy *p)
 {
        struct listener *l;
 
-       if (!(p->cap & PR_CAP_FE) || p->state == PR_STERROR ||
+       if (!(p->cap & PR_CAP_FE) ||
            p->state == PR_STSTOPPED || p->state == PR_STPAUSED)
                return 1;
 
        ha_warning("Pausing %s %s.\n", proxy_cap_str(p->cap), p->id);
        send_log(p, LOG_WARNING, "Pausing %s %s.\n", proxy_cap_str(p->cap), p->id);
 
-       list_for_each_entry(l, &p->conf.listeners, by_fe) {
-               if (!pause_listener(l))
-                       p->state = PR_STERROR;
-       }
+       list_for_each_entry(l, &p->conf.listeners, by_fe)
+               pause_listener(l);
 
-       if (p->state == PR_STERROR) {
+       if (p->li_ready) {
                ha_warning("%s %s failed to enter pause mode.\n", proxy_cap_str(p->cap), p->id);
                send_log(p, LOG_WARNING, "%s %s failed to enter pause mode.\n", proxy_cap_str(p->cap), p->id);
                return 0;