BUG/MINOR: backend: nbsrv() should return 0 if backend is disabled

According to nbsrv() documentation this fetcher should return "an
integer value corresponding to the number of usable servers".
In case backend is disabled none of servers is usable, so I believe
fetcher should return 0.

This patch should be backported to 1.7, 1.6, 1.5.
This commit is contained in:
Marcin Deranek 2016-12-22 16:21:08 +01:00 committed by Willy Tarreau
parent ef934603c0
commit 57b877147d

View File

@ -1607,7 +1607,9 @@ smp_fetch_nbsrv(const struct arg *args, struct sample *smp, const char *kw, void
smp->data.type = SMP_T_SINT; smp->data.type = SMP_T_SINT;
px = args->data.prx; px = args->data.prx;
if (px->srv_act) if (px->state == PR_STSTOPPED)
smp->data.u.sint = 0;
else if (px->srv_act)
smp->data.u.sint = px->srv_act; smp->data.u.sint = px->srv_act;
else if (px->lbprm.fbck) else if (px->lbprm.fbck)
smp->data.u.sint = 1; smp->data.u.sint = 1;