summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilly Tarreau <w@1wt.eu>2020-09-24 07:44:34 +0200
committerWilly Tarreau <w@1wt.eu>2020-10-07 18:44:08 +0200
commit6932af3229cb630bdba017d9988669b70eee7887 (patch)
treed1b59f3cd50403997b2234e9909506d0a76387c0
parent375c5e078e4b701cbaf601e7b8eee0d925c731e5 (diff)
downloadhaproxy-6932af3229cb630bdba017d9988669b70eee7887.tar.gz
MEDIUM: proxy: remove the PR_STERROR state
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.
-rw-r--r--include/haproxy/proxy-t.h1
-rw-r--r--src/proxy.c14
2 files changed, 5 insertions, 10 deletions
diff --git a/include/haproxy/proxy-t.h b/include/haproxy/proxy-t.h
index f0c61b3b7..f2fdf01d5 100644
--- a/include/haproxy/proxy-t.h
+++ b/include/haproxy/proxy-t.h
@@ -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 */
diff --git a/src/proxy.c b/src/proxy.c
index d3c207e71..06fb0d9f6 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -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;