|
|
|
@ -236,18 +236,15 @@ static void picked_target(void *arg, int iomgr_success) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void pick_target(grpc_lb_policy *lb_policy, call_data *calld) { |
|
|
|
|
static void pick_target( |
|
|
|
|
grpc_lb_policy *lb_policy, call_data *calld, grpc_pollset *bind_pollset) { |
|
|
|
|
grpc_metadata_batch *initial_metadata; |
|
|
|
|
grpc_transport_stream_op *op = &calld->waiting_op; |
|
|
|
|
|
|
|
|
|
GPR_ASSERT(op->bind_pollset); |
|
|
|
|
GPR_ASSERT(op->send_ops); |
|
|
|
|
GPR_ASSERT(op->send_ops->nops >= 1); |
|
|
|
|
GPR_ASSERT(op->send_ops->ops[0].type == GRPC_OP_METADATA); |
|
|
|
|
initial_metadata = &op->send_ops->ops[0].data.metadata; |
|
|
|
|
|
|
|
|
|
grpc_iomgr_closure_init(&calld->async_setup_task, picked_target, calld); |
|
|
|
|
grpc_lb_policy_pick(lb_policy, op->bind_pollset, initial_metadata, |
|
|
|
|
grpc_lb_policy_pick(lb_policy, bind_pollset, initial_metadata, |
|
|
|
|
&calld->picked_channel, &calld->async_setup_task); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -358,12 +355,19 @@ static void perform_transport_stream_op(grpc_call_element *elem, |
|
|
|
|
gpr_mu_lock(&chand->mu_config); |
|
|
|
|
lb_policy = chand->lb_policy; |
|
|
|
|
if (lb_policy) { |
|
|
|
|
grpc_pollset *bind_pollset = calld->waiting_op.bind_pollset; |
|
|
|
|
GRPC_LB_POLICY_REF(lb_policy, "pick"); |
|
|
|
|
gpr_mu_unlock(&chand->mu_config); |
|
|
|
|
calld->state = CALL_WAITING_FOR_PICK; |
|
|
|
|
|
|
|
|
|
GPR_ASSERT(calld->waiting_op.bind_pollset); |
|
|
|
|
GPR_ASSERT(calld->waiting_op.send_ops); |
|
|
|
|
GPR_ASSERT(calld->waiting_op.send_ops->nops >= 1); |
|
|
|
|
GPR_ASSERT( |
|
|
|
|
calld->waiting_op.send_ops->ops[0].type == GRPC_OP_METADATA); |
|
|
|
|
gpr_mu_unlock(&calld->mu_state); |
|
|
|
|
|
|
|
|
|
pick_target(lb_policy, calld); |
|
|
|
|
pick_target(lb_policy, calld, bind_pollset); |
|
|
|
|
|
|
|
|
|
GRPC_LB_POLICY_UNREF(lb_policy, "pick"); |
|
|
|
|
} else if (chand->resolver != NULL) { |
|
|
|
|