aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/channel/client_channel.c
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-07-01 09:45:21 -0700
committerGravatar Craig Tiller <ctiller@google.com>2015-07-01 09:45:21 -0700
commitb9a46ae5d7044c6b436a33341135ead3f6fd7779 (patch)
tree3d6eb82b86855c8bcf7e37a69e7d1528d1ba0b54 /src/core/channel/client_channel.c
parent06a1963435bdfa4745a503ce4a6c0422302841f1 (diff)
Fix a bug where cancelled calls can be stranded past disconnection
Diffstat (limited to 'src/core/channel/client_channel.c')
-rw-r--r--src/core/channel/client_channel.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/core/channel/client_channel.c b/src/core/channel/client_channel.c
index a4de59efb1..5d9331d2c5 100644
--- a/src/core/channel/client_channel.c
+++ b/src/core/channel/client_channel.c
@@ -330,9 +330,6 @@ static void perform_transport_stream_op(grpc_call_element *elem,
} else {
consumed_op = merge_into_waiting_op(elem, op);
gpr_mu_unlock(&calld->mu_state);
- if (op->on_consumed != NULL) {
- op->on_consumed->cb(op->on_consumed->cb_arg, 0);
- }
}
break;
}
@@ -362,11 +359,16 @@ static void perform_transport_stream_op(grpc_call_element *elem,
pick_target(lb_policy, calld);
GRPC_LB_POLICY_UNREF(lb_policy, "pick");
- } else {
+ } else if (chand->resolver != NULL) {
calld->state = CALL_WAITING_FOR_CONFIG;
add_to_lb_policy_wait_queue_locked_state_config(elem);
gpr_mu_unlock(&chand->mu_config);
gpr_mu_unlock(&calld->mu_state);
+ } else {
+ calld->state = CALL_CANCELLED;
+ gpr_mu_unlock(&chand->mu_config);
+ gpr_mu_unlock(&calld->mu_state);
+ handle_op_after_cancellation(elem, op);
}
}
}
@@ -402,7 +404,7 @@ static void cc_on_config_changed(void *arg, int iomgr_success) {
gpr_mu_lock(&chand->mu_config);
old_lb_policy = chand->lb_policy;
chand->lb_policy = lb_policy;
- if (lb_policy != NULL) {
+ if (lb_policy != NULL || chand->resolver == NULL /* disconnected */) {
wakeup_closures = chand->waiting_for_config_closures;
chand->waiting_for_config_closures = NULL;
}