Merge pull request #11779 from markdroth/client_channel_fix

Don't set the channel's state to TRANSIENT_FAILURE if we updated the LB policy.
pull/11807/head
Mark D. Roth 8 years ago committed by GitHub
commit e5b847cea4
  1. 9
      src/core/ext/filters/client_channel/client_channel.c

@ -371,6 +371,7 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx *exec_ctx,
grpc_error_string(error)); grpc_error_string(error));
} }
// Extract the following fields from the resolver result, if non-NULL. // Extract the following fields from the resolver result, if non-NULL.
bool lb_policy_updated = false;
char *lb_policy_name = NULL; char *lb_policy_name = NULL;
bool lb_policy_name_changed = false; bool lb_policy_name_changed = false;
grpc_lb_policy *new_lb_policy = NULL; grpc_lb_policy *new_lb_policy = NULL;
@ -425,6 +426,7 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx *exec_ctx,
strcmp(chand->info_lb_policy_name, lb_policy_name) != 0; strcmp(chand->info_lb_policy_name, lb_policy_name) != 0;
if (chand->lb_policy != NULL && !lb_policy_name_changed) { if (chand->lb_policy != NULL && !lb_policy_name_changed) {
// Continue using the same LB policy. Update with new addresses. // Continue using the same LB policy. Update with new addresses.
lb_policy_updated = true;
grpc_lb_policy_update_locked(exec_ctx, chand->lb_policy, &lb_policy_args); grpc_lb_policy_update_locked(exec_ctx, chand->lb_policy, &lb_policy_args);
} else { } else {
// Instantiate new LB policy. // Instantiate new LB policy.
@ -570,8 +572,11 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx *exec_ctx,
} }
watch_lb_policy_locked(exec_ctx, chand, new_lb_policy, state); watch_lb_policy_locked(exec_ctx, chand, new_lb_policy, state);
} }
set_channel_connectivity_state_locked( if (!lb_policy_updated) {
exec_ctx, chand, state, GRPC_ERROR_REF(state_error), "new_lb+resolver"); set_channel_connectivity_state_locked(exec_ctx, chand, state,
GRPC_ERROR_REF(state_error),
"new_lb+resolver");
}
grpc_resolver_next_locked(exec_ctx, chand->resolver, grpc_resolver_next_locked(exec_ctx, chand->resolver,
&chand->resolver_result, &chand->resolver_result,
&chand->on_resolver_result_changed); &chand->on_resolver_result_changed);

Loading…
Cancel
Save