From: Willy Tarreau Date: Wed, 23 Sep 2020 06:05:47 +0000 (+0200) Subject: MINOR: backend: make the "whole" option of balance uri take only one bit X-Git-Tag: v2.1.9~10 X-Git-Url: http://git.haproxy.org/?a=commitdiff_plain;h=2c2d7e7398d47482c568c979b191f67313c4ab3f;p=haproxy-2.1.git MINOR: backend: make the "whole" option of balance uri take only one bit We'll want to add other boolean options on "balance uri", so let's make some room aside "whole" and make it take only one bit and not one int. (cherry picked from commit 3d1119d2257692f1508dd42f32c1840de0e16173) Signed-off-by: Willy Tarreau (cherry picked from commit 0df04e4b0f99ad22ad95ea5554a4d361e8df489d) Signed-off-by: Willy Tarreau --- diff --git a/src/backend.c b/src/backend.c index e8a437e..a2e42b2 100644 --- a/src/backend.c +++ b/src/backend.c @@ -199,8 +199,8 @@ static struct server *get_server_sh(struct proxy *px, const char *addr, int len, * it will either look for active servers, or for backup servers. * If any server is found, it will be returned. If no valid server is found, * NULL is returned. The lbprm.arg_opt{1,2,3} values correspond respectively to - * the "whole" optional argument (boolean), the "len" argument (numeric) and - * the "depth" argument (numeric). + * the "whole" optional argument (boolean, bit0), the "len" argument (numeric) + * and the "depth" argument (numeric). * * This code was contributed by Guillaume Dallaire, who also selected this hash * algorithm out of a tens because it gave him the best results. @@ -231,7 +231,7 @@ static struct server *get_server_uh(struct proxy *px, char *uri, int uri_len, co if (slashes == px->lbprm.arg_opt3) /* depth+1 */ break; } - else if (c == '?' && !px->lbprm.arg_opt1) // "whole" + else if (c == '?' && !(px->lbprm.arg_opt1 & 1)) // "whole" break; end++; } @@ -1901,7 +1901,7 @@ int backend_parse_balance(const char **args, char **err, struct proxy *curproxy) arg += 2; } else if (!strcmp(args[arg], "whole")) { - curproxy->lbprm.arg_opt1 = 1; + curproxy->lbprm.arg_opt1 |= 1; arg += 1; } else {