enum pr_state {
PR_STNEW = 0, /* proxy has not been initialized yet */
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) */
} __attribute__((packed));
{
struct listener *l;
- if (!(p->cap & PR_CAP_FE) ||
- p->state == PR_STSTOPPED || p->state == PR_STPAUSED)
+ if (!(p->cap & PR_CAP_FE) || p->state == PR_STSTOPPED || !p->li_ready)
return 1;
ha_warning("Pausing %s %s.\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;
}
-
- p->state = PR_STPAUSED;
return 1;
}
struct listener *l;
int fail;
- if (p->state != PR_STPAUSED)
+ if (p->state == PR_STSTOPPED || !p->li_paused)
return 1;
ha_warning("Enabling %s %s.\n", proxy_cap_str(p->cap), p->id);
}
}
- p->state = PR_STREADY;
if (fail) {
pause_proxy(p);
return 0;
if (px->state == PR_STSTOPPED)
return cli_msg(appctx, LOG_NOTICE, "Frontend was previously shut down, cannot disable.\n");
- if (px->state == PR_STPAUSED)
- return cli_msg(appctx, LOG_NOTICE, "Frontend is already disabled.\n");
+ if (!px->li_ready)
+ return cli_msg(appctx, LOG_NOTICE, "All sockets are already disabled.\n");
HA_SPIN_LOCK(PROXY_LOCK, &px->lock);
ret = pause_proxy(px);
if (px->state == PR_STSTOPPED)
return cli_err(appctx, "Frontend was previously shut down, cannot enable.\n");
- if (px->state != PR_STPAUSED)
- return cli_msg(appctx, LOG_NOTICE, "Frontend is already enabled.\n");
+ if (px->li_ready == px->li_all)
+ return cli_msg(appctx, LOG_NOTICE, "All sockets are already enabled.\n");
HA_SPIN_LOCK(PROXY_LOCK, &px->lock);
ret = resume_proxy(px);