mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-14 15:34:35 +00:00
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.
This commit is contained in:
parent
6b3bf733dd
commit
a17c91b37f
@ -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 */
|
||||
|
14
src/proxy.c
14
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;
|
||||
|
Loading…
Reference in New Issue
Block a user