diff options
author | Craig Tiller <ctiller@google.com> | 2016-12-14 08:34:32 -0800 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2017-01-06 14:54:42 -0800 |
commit | 6538504ed55590e8b4ab6b51339dc00bdf38ac9b (patch) | |
tree | b453e3fe7e3e4d113a7300469a4a98909348e8bf /src/core | |
parent | 76dca1995352461a97825a28a816c97f0eac2cfb (diff) |
Fixes
Diffstat (limited to 'src/core')
4 files changed, 23 insertions, 12 deletions
diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 6ca00032d1..51191f338e 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -1474,13 +1474,13 @@ void grpc_chttp2_fake_status(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, s->recv_trailing_metadata_finished != NULL) { char status_string[GPR_LTOA_MIN_BUFSIZE]; gpr_ltoa(status, status_string); - grpc_chttp2_incoming_metadata_buffer_add( - &s->metadata_buffer[1], + grpc_chttp2_incoming_metadata_buffer_replace_or_add( + exec_ctx, &s->metadata_buffer[1], grpc_mdelem_from_slices(exec_ctx, GRPC_MDSTR_GRPC_STATUS, grpc_slice_from_copied_string(status_string))); if (msg != NULL) { - grpc_chttp2_incoming_metadata_buffer_add( - &s->metadata_buffer[1], + grpc_chttp2_incoming_metadata_buffer_replace_or_add( + exec_ctx, &s->metadata_buffer[1], grpc_mdelem_from_slices(exec_ctx, GRPC_MDSTR_GRPC_MESSAGE, grpc_slice_from_copied_string(msg))); } @@ -1584,7 +1584,9 @@ void grpc_chttp2_mark_stream_closed(grpc_exec_ctx *exec_ctx, /* Purge streams waiting on concurrency still waiting for id assignment */ grpc_chttp2_list_remove_waiting_for_concurrency(t, s); } - grpc_chttp2_fake_status(exec_ctx, t, s, overall_error); + if (overall_error != GRPC_ERROR_NONE) { + grpc_chttp2_fake_status(exec_ctx, t, s, overall_error); + } } if (closed_read) { decrement_active_streams_locked(exec_ctx, t, s); diff --git a/src/core/ext/transport/chttp2/transport/incoming_metadata.c b/src/core/ext/transport/chttp2/transport/incoming_metadata.c index fd1b234b8f..4e4e41734a 100644 --- a/src/core/ext/transport/chttp2/transport/incoming_metadata.c +++ b/src/core/ext/transport/chttp2/transport/incoming_metadata.c @@ -68,6 +68,19 @@ void grpc_chttp2_incoming_metadata_buffer_add( buffer->size += GRPC_MDELEM_LENGTH(elem); } +void grpc_chttp2_incoming_metadata_buffer_replace_or_add( + grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_metadata_buffer *buffer, + grpc_mdelem elem) { + for (size_t i = 0; i < buffer->count; i++) { + if (grpc_slice_eq(GRPC_MDKEY(buffer->elems[i].md), GRPC_MDKEY(elem))) { + GRPC_MDELEM_UNREF(exec_ctx, buffer->elems[i].md); + buffer->elems[i].md = elem; + return; + } + } + grpc_chttp2_incoming_metadata_buffer_add(buffer, elem); +} + void grpc_chttp2_incoming_metadata_buffer_set_deadline( grpc_chttp2_incoming_metadata_buffer *buffer, gpr_timespec deadline) { GPR_ASSERT(!buffer->published); diff --git a/src/core/ext/transport/chttp2/transport/incoming_metadata.h b/src/core/ext/transport/chttp2/transport/incoming_metadata.h index cd6dacc5bf..1eac6fc150 100644 --- a/src/core/ext/transport/chttp2/transport/incoming_metadata.h +++ b/src/core/ext/transport/chttp2/transport/incoming_metadata.h @@ -56,6 +56,9 @@ void grpc_chttp2_incoming_metadata_buffer_publish( void grpc_chttp2_incoming_metadata_buffer_add( grpc_chttp2_incoming_metadata_buffer *buffer, grpc_mdelem elem); +void grpc_chttp2_incoming_metadata_buffer_replace_or_add( + grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_metadata_buffer *buffer, + grpc_mdelem elem); void grpc_chttp2_incoming_metadata_buffer_set_deadline( grpc_chttp2_incoming_metadata_buffer *buffer, gpr_timespec deadline); diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index f7e7dff097..4f53b69455 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -608,9 +608,6 @@ static void get_final_status(grpc_call *call, grpc_error_get_status(call->status[i].error, call->send_deadline, &code, &msg, NULL); - gpr_log(GPR_DEBUG, "%s --> %d %s", - grpc_error_string(call->status[i].error), code, msg); - set_value(code, set_value_user_data); if (details != NULL) { *details = grpc_slice_from_copied_string(msg); @@ -627,10 +624,6 @@ static void get_final_status(grpc_call *call, static void set_status_from_error(grpc_exec_ctx *exec_ctx, grpc_call *call, status_source source, grpc_error *error) { - const char *es = grpc_error_string(error); - gpr_log(GPR_DEBUG, "%p[%d]: set %d[is_set=%d] to %s", call, call->is_client, - source, call->status[source].is_set, es); - if (call->status[source].is_set) { GRPC_ERROR_UNREF(error); return; |