diff options
author | David Garcia Quintas <dgq@google.com> | 2015-10-06 19:45:36 -0700 |
---|---|---|
committer | David Garcia Quintas <dgq@google.com> | 2015-10-06 19:46:25 -0700 |
commit | 64824bebea2dfdeb273776c0ba14c370941af1bb (patch) | |
tree | c50c59922928b821cd68430f48a382dd20c4f44b /src/core/surface | |
parent | a4aba6e66876d9f3babda8644949fd3cb4bb9745 (diff) |
Fixed unprotected access to call field
Diffstat (limited to 'src/core/surface')
-rw-r--r-- | src/core/surface/call.c | 16 | ||||
-rw-r--r-- | src/core/surface/call.h | 5 |
2 files changed, 14 insertions, 7 deletions
diff --git a/src/core/surface/call.c b/src/core/surface/call.c index d15a3bcbad..c8b880b0ad 100644 --- a/src/core/surface/call.c +++ b/src/core/surface/call.c @@ -522,8 +522,12 @@ static void set_compression_algorithm(grpc_call *call, } grpc_compression_algorithm grpc_call_get_compression_algorithm( - const grpc_call *call) { - return call->compression_algorithm; + grpc_call *call) { + grpc_compression_algorithm algorithm; + gpr_mu_lock(&call->mu); + algorithm = call->compression_algorithm; + gpr_mu_unlock(&call->mu); + return algorithm; } static void set_encodings_accepted_by_peer( @@ -561,8 +565,12 @@ gpr_uint32 grpc_call_get_encodings_accepted_by_peer(grpc_call *call) { return call->encodings_accepted_by_peer; } -gpr_uint32 grpc_call_get_message_flags(const grpc_call *call) { - return call->incoming_message_flags; +gpr_uint32 grpc_call_get_message_flags(grpc_call *call) { + gpr_uint32 flags; + gpr_mu_lock(&call->mu); + flags = call->incoming_message_flags; + gpr_mu_unlock(&call->mu); + return flags; } static void set_status_details(grpc_call *call, status_source source, diff --git a/src/core/surface/call.h b/src/core/surface/call.h index f421a81619..cd1db3d417 100644 --- a/src/core/surface/call.h +++ b/src/core/surface/call.h @@ -169,10 +169,9 @@ void *grpc_call_context_get(grpc_call *call, grpc_context_index elem); gpr_uint8 grpc_call_is_client(grpc_call *call); -grpc_compression_algorithm grpc_call_get_compression_algorithm( - const grpc_call *call); +grpc_compression_algorithm grpc_call_get_compression_algorithm(grpc_call *call); -gpr_uint32 grpc_call_get_message_flags(const grpc_call *call); +gpr_uint32 grpc_call_get_message_flags(grpc_call *call); /** Returns a bitset for the encodings (compression algorithms) supported by \a * call's peer. |