Hi,
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.
Attached patch addresses such condition.
Regards,

Marcin Deranek
>From 5b3eeb5d9a214d880773c03e0213a62772f7b271 Mon Sep 17 00:00:00 2001
From: Marcin Deranek <marcin.dera...@booking.com>
Date: Thu, 22 Dec 2016 16:21:08 +0100
Subject: [PATCH] nbsrv() should return 0 if backend is disabled
X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4

---
 src/backend.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/backend.c b/src/backend.c
index 57f811f..69e2c90 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -1608,7 +1608,9 @@ smp_fetch_nbsrv(const struct arg *args, struct sample *smp, const char *kw, void
 	smp->data.type = SMP_T_SINT;
 	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;
 	else if (px->lbprm.fbck)
 		smp->data.u.sint = 1;
-- 
2.10.2

Reply via email to