Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

only check for duplicate server name and not 'host:port:weight' when …

…'name' is configured
  • Loading branch information...
commit 10b2f14135e15a89aaaead66dd9724d07feafa38 1 parent e5d3d94
Manju Rajashekhar authored
Showing with 3 additions and 28 deletions.
  1. +3 −28 src/nc_conf.c
View
31 src/nc_conf.c
@@ -1110,14 +1110,6 @@ conf_pre_validate(struct conf *cf)
}
static int
-conf_server_pname_cmp(const void *t1, const void *t2)
-{
- const struct conf_server *s1 = t1, *s2 = t2;
-
- return string_compare(&s1->pname, &s2->pname);
-}
-
-static int
conf_server_name_cmp(const void *t1, const void *t2)
{
const struct conf_server *s1 = t1, *s2 = t2;
@@ -1156,27 +1148,10 @@ conf_validate_server(struct conf *cf, struct conf_pool *cp)
/*
* Disallow duplicate servers - servers with identical "host:port:weight"
- * or "name" combination are considered as duplicates
+ * or "name" combination are considered as duplicates. When server name
+ * is configured, we only check for duplicate "name" and not for duplicate
+ * "host:port:weight"
*/
- array_sort(&cp->server, conf_server_pname_cmp);
- for (valid = true, i = 0; i < nserver - 1; i++) {
- struct conf_server *cs1, *cs2;
-
- cs1 = array_get(&cp->server, i);
- cs2 = array_get(&cp->server, i + 1);
-
- if (string_compare(&cs1->pname, &cs2->pname) == 0) {
- log_error("conf: pool '%.*s' has servers with same name '%.*s'",
- cp->name.len, cp->name.data, cs1->pname.len,
- cs1->pname.data);
- valid = false;
- break;
- }
- }
- if (!valid) {
- return NC_ERROR;
- }
-
array_sort(&cp->server, conf_server_name_cmp);
for (valid = true, i = 0; i < nserver - 1; i++) {
struct conf_server *cs1, *cs2;
Please sign in to comment.
Something went wrong with that request. Please try again.