Merge pull request #3839 from thess/icecast-update
[feed/packages.git] / net / haproxy / patches / 0015-BUG-MINOR-backend-nbsrv-should-return-0-if-backend-i.patch
1 From 2558c178612254dd5d94a425627a5cb4c21aef2f Mon Sep 17 00:00:00 2001
2 From: Marcin Deranek <marcin.deranek@booking.com>
3 Date: Thu, 22 Dec 2016 16:21:08 +0100
4 Subject: [PATCH 15/19] BUG/MINOR: backend: nbsrv() should return 0 if backend
5 is disabled
6
7 According to nbsrv() documentation this fetcher should return "an
8 integer value corresponding to the number of usable servers".
9 In case backend is disabled none of servers is usable, so I believe
10 fetcher should return 0.
11
12 This patch should be backported to 1.7, 1.6, 1.5.
13 (cherry picked from commit 57b877147d726a743a038e7101b6d2e6922116c7)
14 ---
15 src/backend.c | 4 +++-
16 1 file changed, 3 insertions(+), 1 deletion(-)
17
18 diff --git a/src/backend.c b/src/backend.c
19 index e0e53ff..6224a69 100644
20 --- a/src/backend.c
21 +++ b/src/backend.c
22 @@ -1608,7 +1608,9 @@ smp_fetch_nbsrv(const struct arg *args, struct sample *smp, const char *kw, void
23 smp->data.type = SMP_T_SINT;
24 px = args->data.prx;
25
26 - if (px->srv_act)
27 + if (px->state == PR_STSTOPPED)
28 + smp->data.u.sint = 0;
29 + else if (px->srv_act)
30 smp->data.u.sint = px->srv_act;
31 else if (px->lbprm.fbck)
32 smp->data.u.sint = 1;
33 --
34 2.10.2
35