aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@users.noreply.github.com>2016-03-30 08:02:21 -0700
committerGravatar Jan Tattermusch <jtattermusch@users.noreply.github.com>2016-03-30 08:02:21 -0700
commitfa51d186d9f7c8594afe48bf93bd22767f1c01e2 (patch)
tree60c77f0bf8f9afdcffdbab74ab02864824f1cef0
parent353729a852b24bdbe20b191ceb77cc2008b464b7 (diff)
parentdd2cfc55ab68aee249c3988d5530f0fcc6c6ec58 (diff)
Merge pull request #6022 from grpc/revert-5933-sockaddr_resolver_lb
Revert "added grpclb support to sockaddr resolver"
-rw-r--r--src/core/lib/client_config/resolvers/sockaddr_resolver.c39
1 files changed, 5 insertions, 34 deletions
diff --git a/src/core/lib/client_config/resolvers/sockaddr_resolver.c b/src/core/lib/client_config/resolvers/sockaddr_resolver.c
index 5c5133649a..c787bd57d6 100644
--- a/src/core/lib/client_config/resolvers/sockaddr_resolver.c
+++ b/src/core/lib/client_config/resolvers/sockaddr_resolver.c
@@ -267,46 +267,17 @@ static grpc_resolver *sockaddr_create(
r->lb_policy_name = NULL;
if (0 != strcmp(args->uri->query, "")) {
gpr_slice query_slice;
- gpr_slice_buffer query_parts; /* the &-separated elements of the query */
- gpr_slice_buffer query_param_parts; /* the =-separated subelements */
+ gpr_slice_buffer query_parts;
query_slice =
gpr_slice_new(args->uri->query, strlen(args->uri->query), do_nothing);
gpr_slice_buffer_init(&query_parts);
- gpr_slice_buffer_init(&query_param_parts);
- /* the query can contain "lb_policy=<policy>" and "lb_enabled=<1|0>" */
-
- bool lb_enabled;
- gpr_slice_split(query_slice, "&", &query_parts);
- for (i = 0; i < query_parts.count; i++) {
- gpr_slice_split(query_parts.slices[i], "=", &query_param_parts);
- GPR_ASSERT(query_param_parts.count == 2);
- if (0 == gpr_slice_str_cmp(query_param_parts.slices[0], "lb_policy")) {
- r->lb_policy_name =
- gpr_dump_slice(query_param_parts.slices[1], GPR_DUMP_ASCII);
- } else if (0 ==
- gpr_slice_str_cmp(query_param_parts.slices[0], "lb_enabled")) {
- if (0 != gpr_slice_str_cmp(query_param_parts.slices[1], "0")) {
- /* anything other than 0 is taken to be true */
- lb_enabled = true;
- }
- } else {
- gpr_log(GPR_ERROR, "invalid query element value: '%s'",
- query_parts.slices[0]);
- }
- gpr_slice_buffer_reset_and_unref(&query_param_parts);
- }
-
- if (strcmp("grpclb", r->lb_policy_name) == 0 && !lb_enabled) {
- /* we want grpclb but the "resolved" addresses aren't LB enabled. Bail
- * out, as this is meant mostly for tests. */
- gpr_log(GPR_ERROR,
- "Requested 'grpclb' LB policy but resolved addresses don't "
- "support load balancing.");
- abort();
+ gpr_slice_split(query_slice, "=", &query_parts);
+ GPR_ASSERT(query_parts.count == 2);
+ if (0 == gpr_slice_str_cmp(query_parts.slices[0], "lb_policy")) {
+ r->lb_policy_name = gpr_dump_slice(query_parts.slices[1], GPR_DUMP_ASCII);
}
gpr_slice_buffer_destroy(&query_parts);
- gpr_slice_buffer_destroy(&query_param_parts);
gpr_slice_unref(query_slice);
}
if (r->lb_policy_name == NULL) {