|
|
|
@ -811,19 +811,30 @@ static void rr_update_locked(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy, |
|
|
|
|
sc_args.args = new_args; |
|
|
|
|
grpc_subchannel *subchannel = grpc_client_channel_factory_create_subchannel( |
|
|
|
|
exec_ctx, args->client_channel_factory, &sc_args); |
|
|
|
|
grpc_channel_args_destroy(exec_ctx, new_args); |
|
|
|
|
grpc_error *error; |
|
|
|
|
// Get the connectivity state of the subchannel. Already existing ones may
|
|
|
|
|
// be in a state other than INIT.
|
|
|
|
|
const grpc_connectivity_state subchannel_connectivity_state = |
|
|
|
|
grpc_subchannel_check_connectivity(subchannel, &error); |
|
|
|
|
if (error != GRPC_ERROR_NONE) { |
|
|
|
|
// The subchannel is in error (e.g. shutting down). Ignore it.
|
|
|
|
|
GRPC_SUBCHANNEL_UNREF(exec_ctx, subchannel, "new_sc_connectivity_error"); |
|
|
|
|
GRPC_ERROR_UNREF(error); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if (GRPC_TRACER_ON(grpc_lb_round_robin_trace)) { |
|
|
|
|
char *address_uri = |
|
|
|
|
grpc_sockaddr_to_uri(&addresses->addresses[i].address); |
|
|
|
|
gpr_log( |
|
|
|
|
GPR_DEBUG, |
|
|
|
|
"[RR %p] index %lu: Created subchannel %p for address uri %s into " |
|
|
|
|
"subchannel_list %p", |
|
|
|
|
"subchannel_list %p. Connectivity state %s", |
|
|
|
|
(void *)p, (unsigned long)subchannel_index, (void *)subchannel, |
|
|
|
|
address_uri, (void *)subchannel_list); |
|
|
|
|
address_uri, (void *)subchannel_list, |
|
|
|
|
grpc_connectivity_state_name(subchannel_connectivity_state)); |
|
|
|
|
gpr_free(address_uri); |
|
|
|
|
} |
|
|
|
|
grpc_channel_args_destroy(exec_ctx, new_args); |
|
|
|
|
|
|
|
|
|
subchannel_data *sd = &subchannel_list->subchannels[subchannel_index++]; |
|
|
|
|
sd->subchannel_list = subchannel_list; |
|
|
|
|
sd->subchannel = subchannel; |
|
|
|
@ -835,7 +846,7 @@ static void rr_update_locked(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy, |
|
|
|
|
* won't be referring to this value again and it'll be overwritten after |
|
|
|
|
* the first call to rr_connectivity_changed_locked */ |
|
|
|
|
sd->prev_connectivity_state = GRPC_CHANNEL_INIT; |
|
|
|
|
sd->curr_connectivity_state = GRPC_CHANNEL_IDLE; |
|
|
|
|
sd->curr_connectivity_state = subchannel_connectivity_state; |
|
|
|
|
sd->user_data_vtable = addresses->user_data_vtable; |
|
|
|
|
if (sd->user_data_vtable != NULL) { |
|
|
|
|
sd->user_data = |
|
|
|
|