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"
diff --git a/src/server.c b/src/server.c
index 036c5a1..f62a7e3 100644
--- a/src/server.c
+++ b/src/server.c
@@ -5319,8 +5319,7 @@
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 @@
}
}
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 @@
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 @@
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