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

  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. According to nbsrv() documentation this fetcher should return "an
  7. integer value corresponding to the number of usable servers".
  8. In case backend is disabled none of servers is usable, so I believe
  9. fetcher should return 0.
  10. This patch should be backported to 1.7, 1.6, 1.5.
  11. (cherry picked from commit 57b877147d726a743a038e7101b6d2e6922116c7)
  12. ---
  13. src/backend.c | 4 +++-
  14. 1 file changed, 3 insertions(+), 1 deletion(-)
  15. diff --git a/src/backend.c b/src/backend.c
  16. index e0e53ff..6224a69 100644
  17. --- a/src/backend.c
  18. +++ b/src/backend.c
  19. @@ -1608,7 +1608,9 @@ smp_fetch_nbsrv(const struct arg *args, struct sample *smp, const char *kw, void
  20. smp->data.type = SMP_T_SINT;
  21. px = args->data.prx;
  22. - if (px->srv_act)
  23. + if (px->state == PR_STSTOPPED)
  24. + smp->data.u.sint = 0;
  25. + else if (px->srv_act)
  26. smp->data.u.sint = px->srv_act;
  27. else if (px->lbprm.fbck)
  28. smp->data.u.sint = 1;
  29. --
  30. 2.10.2