aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-03-01 21:41:13 -0800
committerGravatar Craig Tiller <ctiller@google.com>2016-03-01 21:41:13 -0800
commit8e19f61d6230bfb938a82532d5da4c79824501df (patch)
treefaddeae3749f3090decf9931dc2068da2c1602cc /src
parentcff072247eabf1249823590cd6562d542d73f20c (diff)
Fix esan detected race in subchannel state
Diffstat (limited to 'src')
-rw-r--r--src/core/client_config/subchannel.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/core/client_config/subchannel.c b/src/core/client_config/subchannel.c
index bec06bf414..d91dd116b8 100644
--- a/src/core/client_config/subchannel.c
+++ b/src/core/client_config/subchannel.c
@@ -395,7 +395,6 @@ void grpc_subchannel_notify_on_state_change(
grpc_exec_ctx *exec_ctx, grpc_subchannel *c,
grpc_pollset_set *interested_parties, grpc_connectivity_state *state,
grpc_closure *notify) {
- int do_connect = 0;
external_state_watcher *w;
if (state == NULL) {
@@ -425,17 +424,13 @@ void grpc_subchannel_notify_on_state_change(
w->next->prev = w->prev->next = w;
if (grpc_connectivity_state_notify_on_state_change(
exec_ctx, &c->state_tracker, state, &w->closure)) {
- do_connect = 1;
c->connecting = 1;
/* released by connection */
GRPC_SUBCHANNEL_WEAK_REF(c, "connecting");
+ start_connect(exec_ctx, c);
}
gpr_mu_unlock(&c->mu);
}
-
- if (do_connect) {
- start_connect(exec_ctx, c);
- }
}
void grpc_connected_subchannel_process_transport_op(
@@ -635,11 +630,12 @@ static void on_alarm(grpc_exec_ctx *exec_ctx, void *arg, bool iomgr_success) {
if (c->disconnected) {
iomgr_success = 0;
}
- gpr_mu_unlock(&c->mu);
if (iomgr_success) {
update_reconnect_parameters(c);
continue_connect(exec_ctx, c);
+ gpr_mu_unlock(&c->mu);
} else {
+ gpr_mu_unlock(&c->mu);
GRPC_SUBCHANNEL_WEAK_UNREF(exec_ctx, c, "connecting");
}
}