diff options
author | David Garcia Quintas <dgq@google.com> | 2016-09-15 10:02:16 -0700 |
---|---|---|
committer | David Garcia Quintas <dgq@google.com> | 2016-09-15 10:02:16 -0700 |
commit | 5ebb7af9ef074e69fb0173e938fddaa1b6b88913 (patch) | |
tree | 6a5fec7e623a2117fc43aeaef7618c2b3805672e /src/core/ext/lb_policy | |
parent | 6eb48f10732e456301d841d79dd30cdd15995572 (diff) |
Don't assert on use of unsupported user_data for LB policies
Diffstat (limited to 'src/core/ext/lb_policy')
-rw-r--r-- | src/core/ext/lb_policy/grpclb/grpclb.c | 12 | ||||
-rw-r--r-- | src/core/ext/lb_policy/pick_first/pick_first.c | 6 |
2 files changed, 12 insertions, 6 deletions
diff --git a/src/core/ext/lb_policy/grpclb/grpclb.c b/src/core/ext/lb_policy/grpclb/grpclb.c index 3ce3910b30..cf32658333 100644 --- a/src/core/ext/lb_policy/grpclb/grpclb.c +++ b/src/core/ext/lb_policy/grpclb/grpclb.c @@ -573,8 +573,10 @@ static grpc_lb_policy *glb_create(grpc_exec_ctx *exec_ctx, return NULL; } - /* this LB policy doesn't support \a user_data */ - GPR_ASSERT(args->addresses[0].user_data == NULL); + if (args->addresses[0].user_data != NULL) { + gpr_log(GPR_ERROR, + "This LB policy doesn't support user data. It will be ignored"); + } /* construct a target from the addresses in args, given in the form * ipvX://ip1:port1,ip2:port2,... @@ -583,8 +585,10 @@ static grpc_lb_policy *glb_create(grpc_exec_ctx *exec_ctx, addr_strs[0] = grpc_sockaddr_to_uri( (const struct sockaddr *)&args->addresses[0].resolved_address->addr); for (size_t i = 1; i < args->num_addresses; i++) { - /* this LB policy doesn't support \a user_data */ - GPR_ASSERT(args->addresses[i].user_data == NULL); + if (args->addresses[i].user_data != NULL) { + gpr_log(GPR_ERROR, + "This LB policy doesn't support user data. It will be ignored"); + } GPR_ASSERT( grpc_sockaddr_to_string( diff --git a/src/core/ext/lb_policy/pick_first/pick_first.c b/src/core/ext/lb_policy/pick_first/pick_first.c index d907ddd5d1..9513078dce 100644 --- a/src/core/ext/lb_policy/pick_first/pick_first.c +++ b/src/core/ext/lb_policy/pick_first/pick_first.c @@ -451,8 +451,10 @@ static grpc_lb_policy *create_pick_first(grpc_exec_ctx *exec_ctx, grpc_subchannel_args sc_args; size_t subchannel_idx = 0; for (size_t i = 0; i < args->num_addresses; i++) { - /* this LB policy doesn't support \a user_data */ - GPR_ASSERT(args->addresses[i].user_data == NULL); + if (args->addresses[i].user_data != NULL) { + gpr_log(GPR_ERROR, + "This LB policy doesn't support user data. It will be ignored"); + } memset(&sc_args, 0, sizeof(grpc_subchannel_args)); sc_args.addr = |