Hi all,

This is my very first contribution in C in an important project. Please, be
kind :)

- format check with Torvald's checkpatch.pl : OK
- compile test : OK
- small working test : OK (working as expected on a very small test)

Feel free to comment so I can improve next time.


Olivier



2016-12-28 18:14 GMT+01:00 Olivier Doucet <[email protected]>:

> when using "option prefer-last-server", we may not always stay on
> the same backend if we have one of the following option:
> balance uri
> balance url_param
> balance hdr()
> balance rdp-cookie
> ---
>  src/backend.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/src/backend.c b/src/backend.c
> index 57f811f..c297b29 100644
> --- a/src/backend.c
> +++ b/src/backend.c
> @@ -564,12 +564,15 @@ int assign_server(struct stream *s)
>             objt_server(conn->target) && __objt_server(conn->target)->proxy
> == s->be &&
>             ((s->txn && s->txn->flags & TX_PREFER_LAST) ||
>              ((s->be->options & PR_O_PREF_LAST) &&
> +              ((s->be->lbprm.algo & BE_LB_PARM) != BE_LB_HASH_URI &&
> (s->be->lbprm.algo & BE_LB_PARM) != BE_LB_HASH_PRM &&
> +              (s->be->lbprm.algo & BE_LB_PARM) != BE_LB_HASH_HDR &&
> (s->be->lbprm.algo & BE_LB_PARM) != BE_LB_HASH_RDP) &&
>               (!s->be->max_ka_queue ||
>                server_has_room(__objt_server(conn->target)) ||
>                (__objt_server(conn->target)->nbpend + 1) <
> s->be->max_ka_queue))) &&
>             srv_is_usable(__objt_server(conn->target))) {
>                 /* This stream was relying on a server in a previous
> request
> -                * and the proxy has "option prefer-last-server" set, so
> +                * and the proxy has "option prefer-last-server" set
> +                * and we dont balance by URI / header / RDP cookie, so
>                  * let's try to reuse the same server.
>                  */
>                 srv = __objt_server(conn->target);
> --
> 1.7.1
>
>

Reply via email to