aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/surface
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-06-23 09:26:21 -0700
committerGravatar Craig Tiller <ctiller@google.com>2015-06-23 09:26:21 -0700
commit949b6ee7962aa01a6d3940380d1c3ecc85e85f4a (patch)
treed83f2d71923d2e2d3574ff1850500da69b2923fe /src/core/surface
parent624babfcd8f0aa26f74b2669c5c0d34ee8b7881a (diff)
parentf8fedc43d76f171b8f87bb65dc5d253e67db996f (diff)
Merge github.com:grpc/grpc into oops-i-split-it-again
Diffstat (limited to 'src/core/surface')
-rw-r--r--src/core/surface/call.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/core/surface/call.c b/src/core/surface/call.c
index 80ede29d39..eda7e1f6fd 100644
--- a/src/core/surface/call.c
+++ b/src/core/surface/call.c
@@ -413,6 +413,8 @@ void grpc_call_internal_unref(grpc_call *c, int allow_immediate_deletion) {
static void set_status_code(grpc_call *call, status_source source,
gpr_uint32 status) {
+ if (call->status[source].is_set) return;
+
call->status[source].is_set = 1;
call->status[source].code = status;
@@ -1215,9 +1217,14 @@ static gpr_uint32 decode_compression(grpc_mdelem *md) {
if (user_data) {
clevel = ((grpc_compression_level)(gpr_intptr)user_data) - COMPRESS_OFFSET;
} else {
- if (!gpr_parse_bytes_to_uint32(grpc_mdstr_as_c_string(md->value),
+ gpr_uint32 parsed_clevel_bytes;
+ if (gpr_parse_bytes_to_uint32(grpc_mdstr_as_c_string(md->value),
GPR_SLICE_LENGTH(md->value->slice),
- &clevel)) {
+ &parsed_clevel_bytes)) {
+ /* the following cast is safe, as a gpr_uint32 should be able to hold all
+ * possible values of the grpc_compression_level enum */
+ clevel = (grpc_compression_level) parsed_clevel_bytes;
+ } else {
clevel = GRPC_COMPRESS_LEVEL_NONE; /* could not parse, no compression */
}
grpc_mdelem_set_user_data(md, destroy_compression,