You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

35 lines
1.1 KiB

From 2558c178612254dd5d94a425627a5cb4c21aef2f Mon Sep 17 00:00:00 2001
From: Marcin Deranek <marcin.deranek@booking.com>
Date: Thu, 22 Dec 2016 16:21:08 +0100
Subject: [PATCH 15/19] 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.
(cherry picked from commit 57b877147d726a743a038e7101b6d2e6922116c7)
---
src/backend.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/backend.c b/src/backend.c
index e0e53ff..6224a69 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