From 26205360fe57350d300fc60626d51727b6595f0f Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 21 Jul 2015 08:21:57 -0700 Subject: [PATCH] Fix (forever) a TSAN bug thats plagued us --- src/core/iomgr/tcp_client_posix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/iomgr/tcp_client_posix.c b/src/core/iomgr/tcp_client_posix.c index dc0489e64f4..2ae0251abb0 100644 --- a/src/core/iomgr/tcp_client_posix.c +++ b/src/core/iomgr/tcp_client_posix.c @@ -114,6 +114,8 @@ static void on_writable(void *acp, int success) { void (*cb)(void *arg, grpc_endpoint *tcp) = ac->cb; void *cb_arg = ac->cb_arg; + grpc_alarm_cancel(&ac->alarm); + gpr_mu_lock(&ac->mu); if (success) { do { @@ -178,8 +180,6 @@ finish: if (done) { gpr_mu_destroy(&ac->mu); gpr_free(ac); - } else { - grpc_alarm_cancel(&ac->alarm); } cb(cb_arg, ep); }