struct lb_fwlc fwlc;
struct lb_chash chash;
struct lb_fas fas;
- /* Call backs for some actions. Some may be NULL (thus should be ignored). */
+ /* Call backs for some actions. Any of them may be NULL (thus should be ignored). */
void (*update_server_eweight)(struct server *); /* to be called after eweight change */
void (*set_server_status_up)(struct server *); /* to be called after status changes to UP */
void (*set_server_status_down)(struct server *); /* to be called after status changes to DOWN */
s->last_change = now.tv_sec;
s->state &= ~(SRV_RUNNING | SRV_GOINGDOWN);
- s->proxy->lbprm.set_server_status_down(s);
+ if (s->proxy->lbprm.set_server_status_down)
+ s->proxy->lbprm.set_server_status_down(s);
if (s->onmarkeddown & HANA_ONMARKEDDOWN_SHUTDOWNSESSIONS)
shutdown_sessions(s);
}
task_schedule(s->warmup, tick_add(now_ms, MS_TO_TICKS(MAX(1000, s->slowstart / 20))));
}
- s->proxy->lbprm.set_server_status_up(s);
+ if (s->proxy->lbprm.set_server_status_up)
+ s->proxy->lbprm.set_server_status_up(s);
/* check if we can handle some connections queued at the proxy. We
* will take as many as we can handle.
int xferred;
s->state |= SRV_GOINGDOWN;
- s->proxy->lbprm.set_server_status_down(s);
+ if (s->proxy->lbprm.set_server_status_down)
+ s->proxy->lbprm.set_server_status_down(s);
/* we might have sessions queued on this server and waiting for
* a connection. Those which are redispatchable will be queued
int xferred;
s->state &= ~SRV_GOINGDOWN;
- s->proxy->lbprm.set_server_status_up(s);
+ if (s->proxy->lbprm.set_server_status_up)
+ s->proxy->lbprm.set_server_status_up(s);
/* check if we can handle some connections queued at the proxy. We
* will take as many as we can handle.
/* static LB algorithms are a bit harder to update */
if (px->lbprm.update_server_eweight)
px->lbprm.update_server_eweight(sv);
- else if (sv->eweight)
- px->lbprm.set_server_status_up(sv);
- else
- px->lbprm.set_server_status_down(sv);
+ else if (sv->eweight) {
+ if (px->lbprm.set_server_status_up)
+ px->lbprm.set_server_status_up(sv);
+ }
+ else {
+ if (px->lbprm.set_server_status_down)
+ px->lbprm.set_server_status_down(sv);
+ }
return 1;
}