mirror of
https://github.com/haproxy/haproxy.git
synced 2026-05-28 04:12:17 -04:00
MINOR: server: propagate lb changes through srv_lb_propagate()
Now that we have a generic srv_lb_propagate(s) function, let's use it each time we explicitly wan't to set the status down as well. Indeed, it is tricky to try to handle "down" case explicitly, instead we use srv_lb_propagate() which will call the proper function that will handle the new server state. This will allow some code cleanup and will prevent any logic error. This commit depends on: - "MINOR: server: propagate server state change to lb through single function"
This commit is contained in:
parent
8bbe643acc
commit
85b91375bf
1 changed files with 4 additions and 8 deletions
12
src/server.c
12
src/server.c
|
|
@ -5319,8 +5319,7 @@ static void srv_update_status(struct server *s)
|
|||
s->next_admin = s->cur_admin;
|
||||
|
||||
if ((s->cur_state != SRV_ST_STOPPED) && (s->next_state == SRV_ST_STOPPED)) {
|
||||
if (s->proxy->lbprm.set_server_status_down)
|
||||
s->proxy->lbprm.set_server_status_down(s);
|
||||
srv_lb_propagate(s);
|
||||
|
||||
if (s->onmarkeddown & HANA_ONMARKEDDOWN_SHUTDOWNSESSIONS)
|
||||
srv_shutdown_streams(s, SF_ERR_DOWN);
|
||||
|
|
@ -5354,8 +5353,7 @@ static void srv_update_status(struct server *s)
|
|||
}
|
||||
}
|
||||
else if ((s->cur_state != SRV_ST_STOPPING) && (s->next_state == SRV_ST_STOPPING)) {
|
||||
if (s->proxy->lbprm.set_server_status_down)
|
||||
s->proxy->lbprm.set_server_status_down(s);
|
||||
srv_lb_propagate(s);
|
||||
|
||||
/* we might have streams queued on this server and waiting for
|
||||
* a connection. Those which are redispatchable will be queued
|
||||
|
|
@ -5466,8 +5464,7 @@ static void srv_update_status(struct server *s)
|
|||
check->health = 0; /* failure */
|
||||
|
||||
s->next_state = SRV_ST_STOPPED;
|
||||
if (s->proxy->lbprm.set_server_status_down)
|
||||
s->proxy->lbprm.set_server_status_down(s);
|
||||
srv_lb_propagate(s);
|
||||
|
||||
if (s->onmarkeddown & HANA_ONMARKEDDOWN_SHUTDOWNSESSIONS)
|
||||
srv_shutdown_streams(s, SF_ERR_DOWN);
|
||||
|
|
@ -5660,8 +5657,7 @@ static void srv_update_status(struct server *s)
|
|||
if (!(s->cur_admin & SRV_ADMF_DRAIN) && (s->next_admin & SRV_ADMF_DRAIN)) {
|
||||
/* drain state is applied only if not yet in maint */
|
||||
|
||||
if (px->lbprm.set_server_status_down)
|
||||
px->lbprm.set_server_status_down(s);
|
||||
srv_lb_propagate(s);
|
||||
|
||||
/* we might have streams queued on this server and waiting for
|
||||
* a connection. Those which are redispatchable will be queued
|
||||
|
|
|
|||
Loading…
Reference in a new issue