Commit 90624773 authored by Federico G. Schwindt's avatar Federico G. Schwindt

Update description

Minor cosmetic changes while here. Discussed with Dag on Frankfurt.
parent 2e9e32ac
...@@ -288,8 +288,8 @@ backend_find(struct cli *cli, const char *matcher, bf_func *func, void *priv) ...@@ -288,8 +288,8 @@ backend_find(struct cli *cli, const char *matcher, bf_func *func, void *priv)
ssize_t ip_l = 0; ssize_t ip_l = 0;
const char *port_b = NULL; const char *port_b = NULL;
ssize_t port_l = 0; ssize_t port_l = 0;
int found = 0; int all, found = 0;
int i, j; int i;
name_b = matcher; name_b = matcher;
if (matcher != NULL) { if (matcher != NULL) {
...@@ -344,8 +344,8 @@ backend_find(struct cli *cli, const char *matcher, bf_func *func, void *priv) ...@@ -344,8 +344,8 @@ backend_find(struct cli *cli, const char *matcher, bf_func *func, void *priv)
} }
} }
for (j = 0; j < 2; ++j) { for (all = 0; all < 2 && found == 0; all++) {
if (j == 0 && name_b == NULL) if (all == 0 && name_b == NULL)
continue; continue;
VTAILQ_FOREACH(b, &backends, list) { VTAILQ_FOREACH(b, &backends, list) {
CHECK_OBJ_NOTNULL(b, BACKEND_MAGIC); CHECK_OBJ_NOTNULL(b, BACKEND_MAGIC);
...@@ -355,7 +355,7 @@ backend_find(struct cli *cli, const char *matcher, bf_func *func, void *priv) ...@@ -355,7 +355,7 @@ backend_find(struct cli *cli, const char *matcher, bf_func *func, void *priv)
if (name_b != NULL && if (name_b != NULL &&
strncmp(b->vcl_name, name_b, name_l) != 0) strncmp(b->vcl_name, name_b, name_l) != 0)
continue; continue;
if (j == 0 && b->vcl_name[name_l] != '\0') if (all == 0 && b->vcl_name[name_l] != '\0')
continue; continue;
if (ip_b != NULL && if (ip_b != NULL &&
(b->ipv4_addr == NULL || (b->ipv4_addr == NULL ||
...@@ -366,9 +366,7 @@ backend_find(struct cli *cli, const char *matcher, bf_func *func, void *priv) ...@@ -366,9 +366,7 @@ backend_find(struct cli *cli, const char *matcher, bf_func *func, void *priv)
found++; found++;
i = func(cli, b, priv); i = func(cli, b, priv);
if (i) if (i)
return(i); return (i);
if (j == 0)
return (1);
} }
} }
return (found); return (found);
...@@ -473,11 +471,12 @@ cli_backend_set_health(struct cli *cli, const char * const *av, void *priv) ...@@ -473,11 +471,12 @@ cli_backend_set_health(struct cli *cli, const char * const *av, void *priv)
/*---------------------------------------------------------------------*/ /*---------------------------------------------------------------------*/
static struct cli_proto backend_cmds[] = { static struct cli_proto backend_cmds[] = {
{ "backend.list", "backend.list", { "backend.list", "backend.list [<backend_expression>]",
"\tList all backends\n", "\tList backends.",
0, 1, "", cli_backend_list }, 0, 1, "", cli_backend_list },
{ "backend.set_health", "backend.set_health matcher state", { "backend.set_health",
"\tSet health status on a backend\n", "backend.set_health <backend_expression> <state>",
"\tSet health status on the backends.",
2, 2, "", cli_backend_set_health }, 2, 2, "", cli_backend_set_health },
{ NULL } { NULL }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment