aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/ext/resolver
diff options
context:
space:
mode:
authorGravatar David Garcia Quintas <dgq@google.com>2016-09-27 17:24:32 -0700
committerGravatar David Garcia Quintas <dgq@google.com>2016-09-27 18:16:36 -0700
commit5f2e90e3aeb39c53f9b4e71cbf1af0f28f78d46a (patch)
treeaa2ed5732d645e228650658f93ae6eea0228e231 /src/core/ext/resolver
parent7ab8eecdc9c0c2b1ebb2e69d7460bebca774ebd9 (diff)
Populate server_name for sockaddr resolver
Diffstat (limited to 'src/core/ext/resolver')
-rw-r--r--src/core/ext/resolver/sockaddr/sockaddr_resolver.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/core/ext/resolver/sockaddr/sockaddr_resolver.c b/src/core/ext/resolver/sockaddr/sockaddr_resolver.c
index 74d2015e5c..94366458f4 100644
--- a/src/core/ext/resolver/sockaddr/sockaddr_resolver.c
+++ b/src/core/ext/resolver/sockaddr/sockaddr_resolver.c
@@ -53,10 +53,10 @@ typedef struct {
gpr_refcount refs;
/** load balancing policy name */
char *lb_policy_name;
-
+ /** the path component of the uri passed in */
+ char *target_name;
/** the addresses that we've 'resolved' */
grpc_lb_addresses *addresses;
-
/** mutex guarding the rest of the state */
gpr_mu mu;
/** have we published? */
@@ -121,7 +121,8 @@ static void sockaddr_maybe_finish_next_locked(grpc_exec_ctx *exec_ctx,
if (r->next_completion != NULL && !r->published) {
r->published = true;
*r->target_result = grpc_resolver_result_create(
- "", grpc_lb_addresses_copy(r->addresses, NULL /* user_data_copy */),
+ r->target_name,
+ grpc_lb_addresses_copy(r->addresses, NULL /* user_data_copy */),
r->lb_policy_name, NULL);
grpc_exec_ctx_sched(exec_ctx, r->next_completion, GRPC_ERROR_NONE, NULL);
r->next_completion = NULL;
@@ -133,6 +134,7 @@ static void sockaddr_destroy(grpc_exec_ctx *exec_ctx, grpc_resolver *gr) {
gpr_mu_destroy(&r->mu);
grpc_lb_addresses_destroy(r->addresses, NULL /* user_data_destroy */);
gpr_free(r->lb_policy_name);
+ gpr_free(r->target_name);
gpr_free(r);
}
@@ -220,10 +222,12 @@ static grpc_resolver *sockaddr_create(
if (errors_found) break;
}
+ r->target_name = gpr_dump_slice(path_slice, GPR_DUMP_ASCII);
gpr_slice_buffer_destroy(&path_parts);
gpr_slice_unref(path_slice);
if (errors_found) {
gpr_free(r->lb_policy_name);
+ gpr_free(r->target_name);
grpc_lb_addresses_destroy(r->addresses, NULL /* user_data_destroy */);
gpr_free(r);
return NULL;