diff options
author | David G. Quintas <dgq@google.com> | 2016-09-15 23:14:47 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-15 23:14:47 -0700 |
commit | d2f7268bc702d0bf2083b9dedb2ec07544b83dd2 (patch) | |
tree | a63622e66bc476acad8583aedb04b7ef058e6c71 | |
parent | dbe8587c2a1cd9d49e15d160e943d1a94f38ccb2 (diff) | |
parent | 155b8200d40c51981f09ec321b929a5e68c382c4 (diff) |
Merge pull request #8114 from dgquintas/rr_user_data_fix
Round Robin user_data fix
-rw-r--r-- | src/core/ext/lb_policy/round_robin/round_robin.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/core/ext/lb_policy/round_robin/round_robin.c b/src/core/ext/lb_policy/round_robin/round_robin.c index 4434165ff9..a9c37ac0f1 100644 --- a/src/core/ext/lb_policy/round_robin/round_robin.c +++ b/src/core/ext/lb_policy/round_robin/round_robin.c @@ -404,7 +404,10 @@ static int rr_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol, /* readily available, report right away */ gpr_mu_unlock(&p->mu); *target = grpc_subchannel_get_connected_subchannel(selected->subchannel); - *user_data = selected->user_data; + + if (user_data != NULL) { + *user_data = selected->user_data; + } if (grpc_lb_round_robin_trace) { gpr_log(GPR_DEBUG, "[RR PICK] TARGET <-- CONNECTED SUBCHANNEL %p (NODE %p)", @@ -470,7 +473,9 @@ static void rr_connectivity_changed(grpc_exec_ctx *exec_ctx, void *arg, *pp->target = grpc_subchannel_get_connected_subchannel(selected->subchannel); - *pp->user_data = selected->user_data; + if (pp->user_data != NULL) { + *pp->user_data = selected->user_data; + } if (grpc_lb_round_robin_trace) { gpr_log(GPR_DEBUG, "[RR CONN CHANGED] TARGET <-- SUBCHANNEL %p (NODE %p)", |