From ac24ef8a0d2ffeb4b000769ddda619d50a3d9353 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 27 Jun 2016 14:47:47 -0700 Subject: Dont create errors redundently in chttp2_transport.c --- src/core/ext/transport/chttp2/transport/chttp2_transport.c | 12 +++++++----- src/core/ext/transport/chttp2/transport/internal.h | 3 +++ 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'src/core/ext') diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 9c125566d4..5dad40befe 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -594,6 +594,7 @@ static void destroy_stream_locked(grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_metadata_buffer_destroy( &s->global.received_trailing_metadata); gpr_slice_buffer_destroy(&s->writing.flow_controlled_buffer); + GRPC_ERROR_UNREF(s->global.removal_error); UNREF_TRANSPORT(exec_ctx, t, "stream"); @@ -1316,15 +1317,15 @@ static void remove_stream(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, } if (s->parsing.data_parser.parsing_frame != NULL) { grpc_chttp2_incoming_byte_stream_finished( - exec_ctx, s->parsing.data_parser.parsing_frame, - GRPC_ERROR_CREATE_REFERENCING("Stream removed", &error, 1), 0); + exec_ctx, s->parsing.data_parser.parsing_frame, GRPC_ERROR_REF(error), + 0); s->parsing.data_parser.parsing_frame = NULL; } if (grpc_chttp2_unregister_stream(t, s) && t->global.sent_goaway) { close_transport_locked( - exec_ctx, t, - GRPC_ERROR_CREATE("Last stream closed after sending GOAWAY")); + exec_ctx, t, GRPC_ERROR_CREATE_REFERENCING( + "Last stream closed after sending GOAWAY", &error, 1)); } if (grpc_chttp2_list_remove_writable_stream(&t->global, &s->global)) { GRPC_CHTTP2_STREAM_UNREF(exec_ctx, &s->global, "chttp2_writing"); @@ -1451,6 +1452,7 @@ void grpc_chttp2_mark_stream_closed( } } if (stream_global->read_closed && stream_global->write_closed) { + stream_global->removal_error = GRPC_ERROR_REF(error); if (stream_global->id != 0 && TRANSPORT_FROM_GLOBAL(transport_global)->executor.parsing_active) { grpc_chttp2_list_add_closed_waiting_for_parsing(transport_global, @@ -1765,7 +1767,7 @@ static void post_parse_locked(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, GPR_ASSERT(stream_global->write_closed); GPR_ASSERT(stream_global->read_closed); remove_stream(exec_ctx, t, stream_global->id, - GRPC_ERROR_CREATE("Stream removed")); + GRPC_ERROR_REF(stream_global->removal_error)); GRPC_CHTTP2_STREAM_UNREF(exec_ctx, stream_global, "chttp2"); } diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index d63170e350..8d00900669 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -439,6 +439,9 @@ typedef struct { bool seen_error; bool exceeded_metadata_size; + /** the error that resulted in this stream being removed */ + grpc_error *removal_error; + bool published_initial_metadata; bool published_trailing_metadata; bool final_metadata_requested; -- cgit v1.2.3