diff options
author | Mark D. Roth <roth@google.com> | 2016-11-18 09:01:27 -0800 |
---|---|---|
committer | Mark D. Roth <roth@google.com> | 2016-11-18 09:01:27 -0800 |
commit | 062ab441c422cf9f474a1df203891cc5d62bdd13 (patch) | |
tree | 1e475eb6eb08c2ce1d04b6d9f8ba2580b9978b56 /src | |
parent | 96df9e5ef136ef1fbceb6f08c7b1711379b6d152 (diff) |
Fix locking in HTTP CONNECT handshaker.
Diffstat (limited to 'src')
-rw-r--r-- | src/core/ext/client_channel/http_connect_handshaker.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/core/ext/client_channel/http_connect_handshaker.c b/src/core/ext/client_channel/http_connect_handshaker.c index 971bbe8944..c9861a5aed 100644 --- a/src/core/ext/client_channel/http_connect_handshaker.c +++ b/src/core/ext/client_channel/http_connect_handshaker.c @@ -86,9 +86,9 @@ static void http_connect_handshaker_unref(http_connect_handshaker* handshaker) { static void on_write_done(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) { http_connect_handshaker* handshaker = arg; + gpr_mu_lock(&handshaker->mu); if (error != GRPC_ERROR_NONE || handshaker->args == NULL) { // If the write failed, invoke the callback immediately with the error. - gpr_mu_lock(&handshaker->mu); grpc_exec_ctx_sched(exec_ctx, handshaker->on_handshake_done, GRPC_ERROR_REF(error), NULL); handshaker->args = NULL; @@ -97,7 +97,6 @@ static void on_write_done(grpc_exec_ctx* exec_ctx, void* arg, } else { // Otherwise, read the response. // The read callback inherits our ref to the handshaker. - gpr_mu_lock(&handshaker->mu); grpc_endpoint_read(exec_ctx, handshaker->args->endpoint, handshaker->args->read_buffer, &handshaker->response_read_closure); |