mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-28 22:31:06 +01:00
MINOR: server: make use of srv_is_usable() instead of checking eweight
srv_is_usable() is broader than srv_is_usable() as it not only considers the weight but the server's state as well. Future changes will allow a server to be in drain mode with a non-zero weight, so we should migrate to use that function instead.
This commit is contained in:
parent
f4e38b36b8
commit
9943d3117e
@ -99,9 +99,8 @@ void recalc_server_map(struct proxy *px)
|
|||||||
int max = 0;
|
int max = 0;
|
||||||
best = NULL;
|
best = NULL;
|
||||||
for (cur = px->srv; cur; cur = cur->next) {
|
for (cur = px->srv; cur; cur = cur->next) {
|
||||||
if (cur->eweight &&
|
if ((cur->flags & SRV_F_BACKUP) == flag &&
|
||||||
(cur->flags & SRV_F_BACKUP) == flag &&
|
srv_is_usable(cur)) {
|
||||||
(cur->state == SRV_ST_STARTING || cur->state == SRV_ST_RUNNING)) {
|
|
||||||
int v;
|
int v;
|
||||||
|
|
||||||
/* If we are forced to return only one server, we don't want to
|
/* If we are forced to return only one server, we don't want to
|
||||||
|
|||||||
@ -204,7 +204,7 @@ int pendconn_grab_from_px(struct server *s)
|
|||||||
{
|
{
|
||||||
int xferred;
|
int xferred;
|
||||||
|
|
||||||
if (!s->eweight)
|
if (!srv_is_usable(s))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (xferred = 0; !s->maxconn || xferred < srv_dynamic_maxconn(s); xferred++) {
|
for (xferred = 0; !s->maxconn || xferred < srv_dynamic_maxconn(s); xferred++) {
|
||||||
|
|||||||
@ -637,7 +637,7 @@ void server_recalc_eweight(struct server *sv)
|
|||||||
/* now propagate the status change to any LB algorithms */
|
/* now propagate the status change to any LB algorithms */
|
||||||
if (px->lbprm.update_server_eweight)
|
if (px->lbprm.update_server_eweight)
|
||||||
px->lbprm.update_server_eweight(sv);
|
px->lbprm.update_server_eweight(sv);
|
||||||
else if (sv->eweight) {
|
else if (srv_is_usable(sv)) {
|
||||||
if (px->lbprm.set_server_status_up)
|
if (px->lbprm.set_server_status_up)
|
||||||
px->lbprm.set_server_status_up(sv);
|
px->lbprm.set_server_status_up(sv);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user