pull/4451/head
Craig Tiller 9 years ago
parent da308ae28f
commit 457984634e
  1. 8
      src/core/transport/chttp2/writing.c
  2. 29
      src/core/transport/chttp2_transport.c

@ -332,10 +332,6 @@ void grpc_chttp2_cleanup_writing(
while (grpc_chttp2_list_pop_written_stream( while (grpc_chttp2_list_pop_written_stream(
transport_global, transport_writing, &stream_global, &stream_writing)) { transport_global, transport_writing, &stream_global, &stream_writing)) {
if (stream_writing->sent_trailing_metadata) {
grpc_chttp2_mark_stream_closed(exec_ctx, transport_global, stream_global,
!transport_global->is_client, 1);
}
if (stream_writing->sent_initial_metadata) { if (stream_writing->sent_initial_metadata) {
grpc_chttp2_complete_closure_step( grpc_chttp2_complete_closure_step(
exec_ctx, &stream_global->send_initial_metadata_finished, 1); exec_ctx, &stream_global->send_initial_metadata_finished, 1);
@ -350,6 +346,10 @@ void grpc_chttp2_cleanup_writing(
grpc_chttp2_complete_closure_step( grpc_chttp2_complete_closure_step(
exec_ctx, &stream_global->send_trailing_metadata_finished, 1); exec_ctx, &stream_global->send_trailing_metadata_finished, 1);
} }
if (stream_writing->sent_trailing_metadata) {
grpc_chttp2_mark_stream_closed(exec_ctx, transport_global, stream_global,
!transport_global->is_client, 1);
}
GRPC_CHTTP2_STREAM_UNREF(exec_ctx, stream_global, "chttp2_writing"); GRPC_CHTTP2_STREAM_UNREF(exec_ctx, stream_global, "chttp2_writing");
} }
gpr_slice_buffer_reset_and_unref(&transport_writing->outbuf); gpr_slice_buffer_reset_and_unref(&transport_writing->outbuf);

@ -115,11 +115,6 @@ static void close_from_api(grpc_exec_ctx *exec_ctx,
grpc_status_code status, grpc_status_code status,
gpr_slice *optional_message); gpr_slice *optional_message);
/** Fail any outstanding ops */
static void fail_all_outstanding_ops(
grpc_exec_ctx *exec_ctx, grpc_chttp2_transport_global *transport_global,
grpc_chttp2_stream_global *stream_global);
/** Add endpoint from this transport to pollset */ /** Add endpoint from this transport to pollset */
static void add_to_pollset_locked(grpc_exec_ctx *exec_ctx, static void add_to_pollset_locked(grpc_exec_ctx *exec_ctx,
grpc_chttp2_transport *t, grpc_chttp2_transport *t,
@ -753,21 +748,6 @@ void grpc_chttp2_complete_closure_step(grpc_exec_ctx *exec_ctx,
*pclosure = NULL; *pclosure = NULL;
} }
static void fail_all_outstanding_ops(
grpc_exec_ctx *exec_ctx, grpc_chttp2_transport_global *transport_global,
grpc_chttp2_stream_global *stream_global) {
grpc_chttp2_complete_closure_step(
exec_ctx, &stream_global->send_initial_metadata_finished, 0);
grpc_chttp2_complete_closure_step(
exec_ctx, &stream_global->send_trailing_metadata_finished, 0);
grpc_chttp2_complete_closure_step(exec_ctx,
&stream_global->send_message_finished, 0);
grpc_chttp2_complete_closure_step(
exec_ctx, &stream_global->recv_initial_metadata_finished, 0);
grpc_chttp2_complete_closure_step(
exec_ctx, &stream_global->recv_trailing_metadata_finished, 0);
}
static int contains_non_ok_status( static int contains_non_ok_status(
grpc_chttp2_transport_global *transport_global, grpc_chttp2_transport_global *transport_global,
grpc_metadata_batch *batch) { grpc_metadata_batch *batch) {
@ -1042,9 +1022,6 @@ static void check_read_ops(grpc_exec_ctx *exec_ctx,
exec_ctx, &stream_global->recv_trailing_metadata_finished, 1); exec_ctx, &stream_global->recv_trailing_metadata_finished, 1);
} }
} }
if (stream_global->finished_close) {
fail_all_outstanding_ops(exec_ctx, transport_global, stream_global);
}
} }
} }
@ -1146,6 +1123,12 @@ void grpc_chttp2_mark_stream_closed(
} }
if (close_writes && !stream_global->write_closed) { if (close_writes && !stream_global->write_closed) {
stream_global->write_closed = 1; stream_global->write_closed = 1;
grpc_chttp2_complete_closure_step(
exec_ctx, &stream_global->send_initial_metadata_finished, 0);
grpc_chttp2_complete_closure_step(
exec_ctx, &stream_global->send_trailing_metadata_finished, 0);
grpc_chttp2_complete_closure_step(exec_ctx,
&stream_global->send_message_finished, 0);
} }
if (stream_global->read_closed && stream_global->write_closed) { if (stream_global->read_closed && stream_global->write_closed) {
if (stream_global->id != 0 && if (stream_global->id != 0 &&

Loading…
Cancel
Save